I've followed the https://gohugo.io/overview/quickstart/
I then followed the https://gohugo.io/overview/usage/ on deployment on a hugo-only server.
I run the server with:
sudo hugo server --bind=0.0.0.0 --port=80 --theme=hyde
I end up with a non-css/js site. This all works locally, however.
when I attempt to open the site in chrome I get " Failed to load resource: the server responded with a status of 404 (Not Found) " on "http://localhost/css/hyde.css, syntax.css and poole.css". I assume my Pathing is incorrect somewhere.
All files remained untouched, the config.toml included (meaning, it is the default version when creating a site using hugo new site command)
I'm working on an EC2 Ubuntu.
What is your baseURL setting ... and how does that compare to the hostname in use?
Hello bep,
baseurl = "http://replace-this-with-your-hugo-site.com/"
I'm currently connecting to the ec2 using the public ip, http://52.11.165.33/ should I change the baseurl to this ip?
Hi @Fthree,
Please read http://gohugo.io/overview/usage/ again and note the options, then try the following:
sudo hugo server --theme=hyde --bind=0.0.0.0 --baseUrl=http://52.11.165.33/ --port=80 --appendPort=false
@anthonyfok I knew it was something simple that I was missing. The baseUrl got me, thank you very much. I'll give that page another thorough read.
If I recall correctly, whenever the "hugo server" subcommand is used, the baseurl setting in your config.toml or config.yaml is ignored, and instead got substituted by localhost, so you will have to set --baseUrl on the command-line. I wonder if the documentation mentions this or not. (This problem got me too, haha.)
Thank you, I really appreciate your help. The whole thing is still a little bit foreign to me, glad you came through to my help! So the config.toml baseurl is overwritten for the command line --baseUrl? I attempted editing the config.toml baseUrl to the IP to no success.
Yes, it is somewhat tricky. hugo server is most often used for local development, and so hugo server ignores the baseurl variable in config.toml and substitutes it with http://localhost:1313/ so the CSS and JS would load properly.
That's why we need to explicitly override hugo server's own overrides (haha) to get hugo server to work on a production server, hence the explicit --port 80 and --baseUrl=http://yourhostname.com/ on the command-line.
If you are interested, please read #852 for a more thorough discussion. Perhaps eventually we will add a new option called --production perhaps, so that sane defaults will be provided when the user runs hugo server --production.
@anthonyfok's point above was what I needed. It would be great if this were part of the tutorials.
The Quickstart led me to use the Ananke Theme, which lead me to their example site to understand their config, which gave no indication that you have to change the baseUrl (since they are apparently using hugo server.
In fact, this all could have been prevented for me if the gitlab tutorial had simply mentioned you would need to change your baseUrl. Right here would have been perfect: https://gohugo.io/hosting-and-deployment/hosting-on-gitlab/#wait-for-your-page-to-build
Instead, I tried messing with git submodules on gitlab to make sure I had that right, or trying to put the akanke them inside my public folder, and a bunch of other things. :(
Hi, I was able to set the baseURL properly. I am rendering hugo with github pages.
It deploys and I get to see my site with the URL but the theme is totally messed up. It's just simple text, nothing from the theme gets outputted.
Most helpful comment
Yes, it is somewhat tricky.
hugo serveris most often used for local development, and sohugo serverignores thebaseurlvariable inconfig.tomland substitutes it withhttp://localhost:1313/so the CSS and JS would load properly.That's why we need to explicitly override
hugo server's own overrides (haha) to gethugo serverto work on a production server, hence the explicit--port 80and--baseUrl=http://yourhostname.com/on the command-line.If you are interested, please read #852 for a more thorough discussion. Perhaps eventually we will add a new option called
--productionperhaps, so that sane defaults will be provided when the user runshugo server --production.