0

My server runs NGINX. When visiting DOMAIN.org I can see my index page getting presented correctly. Visiting any other link such as DOMAIN.org/path1 results NGINX showing the standard 404 page.

My config: /etc/nginx/sites-enabled/default

server { listen 80 default_server; listen [::]:80 default_server; # root /var/www/html; root /var/www/clients/client0/web1/web; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; proxy_pass http://IP:8090; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } 

proxy_pass http://IP:8090; or proxy_pass http://IP:8090/; both lead to the same outcome... Anybody got any ideas why I only get to see the 404s? Thanks!

1 Answer 1

4

Yes, but this is not the answer you're looking for.

Nginx doesn't see any of your pages - you have configured it to relay everything to http://IP:8090

The reason you are seeing 404s in your browser is because that is what your origin server is returning to nginx. Maybe the reason is explained in the origin server's logs.

6
  • Thanks for the comment Symcbean! I am a complete noob and therefore not sure, how to approach this situation the best. The origin server logs do not show me anything helpful... Would you mind elaborating what I should do or what information needs to be provided in order to get this running? Commented Jan 10, 2024 at 15:52
  • No one has any idea on what to do or has more information...? Help would be greatly appreciated. Commented Jan 10, 2024 at 20:39
  • @IHateCoding remove try_files Commented Jan 11, 2024 at 7:14
  • Thanks Alexey. Unfortunately I receive the following error message: nginx -t nginx: [emerg] unknown directive "$uri" in /etc/nginx/sites-enabled/default:52 nginx: configuration file /etc/nginx/nginx.conf test failed Commented Jan 11, 2024 at 9:59
  • @IHateCoding I mean remove whole line Commented Jan 11, 2024 at 10:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.