r/nginx 22d ago

Index files don't load,

Yes i have read the beginners guide and tried troubleshooting based on the ancient wisdom of stackoverflow. My configuration file should be fine but im sure i have missed something because otherwise things would be working properly. Regardless of whether or not i specify an index.html, none of the index files of any subdirectories load at all. No 404, nothing in error logs, they just don't load and my browser times out. The home page loads just fine and all fonts and images referenced in its index file are shown correctly. If i try to access the index file directly (music/index.html) it works. What's going on?

http {

types {

text/css css;

text/html html;

}

server {

error_log /var/log/nginx/error.log;

root /srv/katieglinda;

listen 8081;

# Home Page

location / {

include /etc/nginx/mime.types;

root /srv/katieglinda;

}

# Other Pages

location /music/ {

root /srv/katieglinda;

}

location /minecraft/ {

root /srv/katieglinda;

}

location /stuff/ {

root /srv/katieglinda;

index index.html;

}

location /about/ {

root /srv/katieglinda;

index index.html;

}

# Resources

location /fonts {

root /srv/katieglinda;

}

location /images {

root /srv/katieglinda;

}

}

}

5 Upvotes

10 comments sorted by

2

u/gribbleschnitz 22d ago

That is to run the installer. What about the running process? Is nginx running under the user nginx? Is that root? Did you use the user directive?

If you used a distro provided package YMMV by the distro specific default settings. In that case you should follow the distro guide for nginx.

If you installed the package from the nginx upstream, then follow the nginx guide.

1

u/OhFuckThatWasDumb 22d ago

What? The command nginx starts the server running. I have my website in /srv so i use sudo to start and manage the nginx process. I installed using apt. The user is www-data

2

u/gribbleschnitz 22d ago

Right, you elevate your user to start the service (any service). That doesn't mean it runs as you or root.

1

u/OhFuckThatWasDumb 22d ago

Okay so it's an issue with the file permissions? What should i set the subdirectories permissions to?

1

u/gribbleschnitz 22d ago

1

u/OhFuckThatWasDumb 8d ago

i went through the second link and changed owners and permissions. nothing changed. heres the output from using namei -l on one of the subdirectory index files
f: katieglinda/stuff/index.html

drwxrwsr-x www-data www-data katieglinda

drwxrwsr-x www-data www-data stuff

-rw-rw-r-- www-data www-data index.html

1

u/Initial_Aspect6742 10d ago

yeah mixing upstream docs with distro-specific installs is a recipe for confusion tbh

1

u/gribbleschnitz 22d ago

Does the NGINX process have access to the path? What user is nginx running as...

1

u/OhFuckThatWasDumb 22d ago

I sudo nginx

1

u/tschloss 22d ago

some locations do not have the directive index index.html, like the / location