How to make hugo server use custom 404.html











up vote
1
down vote

favorite












doc page https://gohugo.io/templates/404/#automatic-loading
says



hugo server will not automatically load your custom 404.html file, but you can test the appearance of your custom “not found” page by navigating your browser to /404.html.



QUESTION:
is there a way to explicitly configure hugo server use custom 404 page?










share|improve this question
























  • Not while using hugo server command. What is it you want to achieve by doing this? hugo server should only be used for development purposes.
    – josephting
    Nov 5 at 7:11










  • @josephting I am kinda lazy and do not want to add nginx to my setup. I do not need any nginx features yet and serving small amount of content directly from memory like hugo server does seems to be better option.
    – ludenus
    Nov 5 at 14:57










  • Unfortunately, it's not possible to do this at the moment. Things might change when hugo implements REST API. github.com/gohugoio/hugo/issues/874
    – josephting
    Nov 6 at 1:27















up vote
1
down vote

favorite












doc page https://gohugo.io/templates/404/#automatic-loading
says



hugo server will not automatically load your custom 404.html file, but you can test the appearance of your custom “not found” page by navigating your browser to /404.html.



QUESTION:
is there a way to explicitly configure hugo server use custom 404 page?










share|improve this question
























  • Not while using hugo server command. What is it you want to achieve by doing this? hugo server should only be used for development purposes.
    – josephting
    Nov 5 at 7:11










  • @josephting I am kinda lazy and do not want to add nginx to my setup. I do not need any nginx features yet and serving small amount of content directly from memory like hugo server does seems to be better option.
    – ludenus
    Nov 5 at 14:57










  • Unfortunately, it's not possible to do this at the moment. Things might change when hugo implements REST API. github.com/gohugoio/hugo/issues/874
    – josephting
    Nov 6 at 1:27













up vote
1
down vote

favorite









up vote
1
down vote

favorite











doc page https://gohugo.io/templates/404/#automatic-loading
says



hugo server will not automatically load your custom 404.html file, but you can test the appearance of your custom “not found” page by navigating your browser to /404.html.



QUESTION:
is there a way to explicitly configure hugo server use custom 404 page?










share|improve this question















doc page https://gohugo.io/templates/404/#automatic-loading
says



hugo server will not automatically load your custom 404.html file, but you can test the appearance of your custom “not found” page by navigating your browser to /404.html.



QUESTION:
is there a way to explicitly configure hugo server use custom 404 page?







http-status-code-404 hugo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 8:49

























asked Nov 4 at 14:55









ludenus

511416




511416












  • Not while using hugo server command. What is it you want to achieve by doing this? hugo server should only be used for development purposes.
    – josephting
    Nov 5 at 7:11










  • @josephting I am kinda lazy and do not want to add nginx to my setup. I do not need any nginx features yet and serving small amount of content directly from memory like hugo server does seems to be better option.
    – ludenus
    Nov 5 at 14:57










  • Unfortunately, it's not possible to do this at the moment. Things might change when hugo implements REST API. github.com/gohugoio/hugo/issues/874
    – josephting
    Nov 6 at 1:27


















  • Not while using hugo server command. What is it you want to achieve by doing this? hugo server should only be used for development purposes.
    – josephting
    Nov 5 at 7:11










  • @josephting I am kinda lazy and do not want to add nginx to my setup. I do not need any nginx features yet and serving small amount of content directly from memory like hugo server does seems to be better option.
    – ludenus
    Nov 5 at 14:57










  • Unfortunately, it's not possible to do this at the moment. Things might change when hugo implements REST API. github.com/gohugoio/hugo/issues/874
    – josephting
    Nov 6 at 1:27
















Not while using hugo server command. What is it you want to achieve by doing this? hugo server should only be used for development purposes.
– josephting
Nov 5 at 7:11




Not while using hugo server command. What is it you want to achieve by doing this? hugo server should only be used for development purposes.
– josephting
Nov 5 at 7:11












@josephting I am kinda lazy and do not want to add nginx to my setup. I do not need any nginx features yet and serving small amount of content directly from memory like hugo server does seems to be better option.
– ludenus
Nov 5 at 14:57




@josephting I am kinda lazy and do not want to add nginx to my setup. I do not need any nginx features yet and serving small amount of content directly from memory like hugo server does seems to be better option.
– ludenus
Nov 5 at 14:57












Unfortunately, it's not possible to do this at the moment. Things might change when hugo implements REST API. github.com/gohugoio/hugo/issues/874
– josephting
Nov 6 at 1:27




Unfortunately, it's not possible to do this at the moment. Things might change when hugo implements REST API. github.com/gohugoio/hugo/issues/874
– josephting
Nov 6 at 1:27












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










This is not possible. Hugo will only produce a static website. You must use a web server in production NOT Hugo's development server.



Hugo should never implement an API of any kind. That's not what it was built for. I have used Hugo for a long time and have never needed such features from Hugo.



If you're able to run hugo serve on a server then you're likely also able to install packages. You should use nginx, or apache, or w/e you feel most comfortable with that's built for production.



Lots of tutorials online:




  1. https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

  2. https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04


It really isn't that difficult and it will save you many headaches in the long run. If you need something to quickly show your site to others (as this is often the case when wanting to use hugo's development server on a public facing machine) try https://ngrok.com/






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53142088%2fhow-to-make-hugo-server-use-custom-404-html%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    This is not possible. Hugo will only produce a static website. You must use a web server in production NOT Hugo's development server.



    Hugo should never implement an API of any kind. That's not what it was built for. I have used Hugo for a long time and have never needed such features from Hugo.



    If you're able to run hugo serve on a server then you're likely also able to install packages. You should use nginx, or apache, or w/e you feel most comfortable with that's built for production.



    Lots of tutorials online:




    1. https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

    2. https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04


    It really isn't that difficult and it will save you many headaches in the long run. If you need something to quickly show your site to others (as this is often the case when wanting to use hugo's development server on a public facing machine) try https://ngrok.com/






    share|improve this answer



























      up vote
      1
      down vote



      accepted










      This is not possible. Hugo will only produce a static website. You must use a web server in production NOT Hugo's development server.



      Hugo should never implement an API of any kind. That's not what it was built for. I have used Hugo for a long time and have never needed such features from Hugo.



      If you're able to run hugo serve on a server then you're likely also able to install packages. You should use nginx, or apache, or w/e you feel most comfortable with that's built for production.



      Lots of tutorials online:




      1. https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

      2. https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04


      It really isn't that difficult and it will save you many headaches in the long run. If you need something to quickly show your site to others (as this is often the case when wanting to use hugo's development server on a public facing machine) try https://ngrok.com/






      share|improve this answer

























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        This is not possible. Hugo will only produce a static website. You must use a web server in production NOT Hugo's development server.



        Hugo should never implement an API of any kind. That's not what it was built for. I have used Hugo for a long time and have never needed such features from Hugo.



        If you're able to run hugo serve on a server then you're likely also able to install packages. You should use nginx, or apache, or w/e you feel most comfortable with that's built for production.



        Lots of tutorials online:




        1. https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

        2. https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04


        It really isn't that difficult and it will save you many headaches in the long run. If you need something to quickly show your site to others (as this is often the case when wanting to use hugo's development server on a public facing machine) try https://ngrok.com/






        share|improve this answer














        This is not possible. Hugo will only produce a static website. You must use a web server in production NOT Hugo's development server.



        Hugo should never implement an API of any kind. That's not what it was built for. I have used Hugo for a long time and have never needed such features from Hugo.



        If you're able to run hugo serve on a server then you're likely also able to install packages. You should use nginx, or apache, or w/e you feel most comfortable with that's built for production.



        Lots of tutorials online:




        1. https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

        2. https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04


        It really isn't that difficult and it will save you many headaches in the long run. If you need something to quickly show your site to others (as this is often the case when wanting to use hugo's development server on a public facing machine) try https://ngrok.com/







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 7 at 20:39

























        answered Nov 7 at 20:34









        BugHunterUK

        2,83721546




        2,83721546






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53142088%2fhow-to-make-hugo-server-use-custom-404-html%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Academy of Television Arts & Sciences

            L'Équipe

            1995 France bombings