I’ve got a basic website set up and am able to run my site on localhost:1313
But every Nginx config I have scrounged for on the net for doesn’t seem to work with my particular setup
I’m hoping to use Nginx on a Linode VPS running on Debian 9
Here’s my directory structure using the hikari theme:
$ pwd
/home/roman/blog
$ ls -al
total 40
drwxr-xr-x 9 roman roman 4096 Jun 26 04:16 .
drwxr-xr-x 9 roman roman 4096 Jun 26 04:07 ..
drwxr-xr-x 2 roman roman 4096 Jun 26 03:05 archetypes
-rw-r--r-- 1 roman roman 1281 Jun 26 03:05 config.toml
drwxr-xr-x 3 roman roman 4096 Jun 26 03:05 content
drwxr-xr-x 2 roman roman 4096 Jun 26 03:05 data
drwxr-xr-x 8 roman roman 4096 Jun 26 03:05 .git
drwxr-xr-x 2 roman roman 4096 Jun 26 03:05 layouts
drwxr-xr-x 3 roman roman 4096 Jun 26 03:05 static
drwxr-xr-x 3 roman roman 4096 Jun 26 03:05 themes
This isn’t the right place for nginx help but, it looks like you’re trying to serve the project folder.
You need to run hugo and have it generate the files to your hosted folder. When you run hugo server it just generates to memory by default, not to disk (although a switch will let you serve from disk).
Thanks, I’ll have to keep reading the nginx docs and see how I can solve the 403 Forbidden errors. This definitely helps, as I couldn’t figure out how to build the site for serving in the first place
TIA for any extra help
Understandable if no one wants to help me with Nginx here
403 errors are permissions usually in my experience.
Edit: or, this could simply be because there’s nothing in that folder for nginx to serve. Create the site folder, point nginx at it, then see if you get the 404. You might use chmod and/or chown in your prep script, to make sure the files are set up how nginx expects.
Wanted to add that when I am learning new server software, I go for the simplest use case. Because Hugo just generates html files, I’d get nginx serving a basic HTML file. So look for tutorials about basic config to get started.
Also, don’t serve your site from /home/. Host it from /srv/ or /var/www/ or similar. Serving it from your home directory will throw those permission errors Rick mentioned (the 403 error).
Side note, @RomanSC, is there any reason why you’re using such old versions of Hugo, Golang, and nginx? I don’t know that this issue would be related to the old software, but I’d want to eliminate all possibilities related to old bugs that have since been fixed.
In particular, you’re using a “Legacy Version” of nginx that was released a year and a half ago. Nginx has Legacy, Stable, and Mainline releases. I’m not sure why anyone would use Legacy at this point.
There have been a massive numbers of releases and bug fixes in both Golang and Hugo since 1.7.4 and 0.18.1. If I were you, I’d update to the current releases of everything, then isolate the bug from there.
I rebuilt the server with Arch Linux, no more old versions of hugo and nginx. I was installing hugo and nginx from the default repositories on Debian which is why the versions would be “old.” I also moved the built site from the home directory to /var/www/public and made sure the folder permissions are 755
For goodness sake (and for everyone’s sake), make sure you are staying current with software that is exposed to the Internet unless you want your machines leaking data and participating in botnets.
Most of the processes for finding and executing vulnerabilities in Internet-facing servers are entirely automatic and there are thousands - quite possibly millions - of bots searching for vulnerabilities 24x7.
Probably that line. From your screenshot, it looks like you are loading the site feed, which makes sense as you tell nginx to serve that as the index: index.xml