D
D
Django Almighty2021-11-07 15:29:05
Nginx
Django Almighty, 2021-11-07 15:29:05

Why doesn't nginx render the route correctly?

I'm scratching my head with nginx. There is a simple config leading to hello world index.html.

Why does this config work:

server {
listen 80;
server_name  localhost;    

location / {
    root   /www/id/html;
    index  index.html index.htm;
  }
}


And here's one that gives a 404 :
server {
listen 80;
server_name  localhost;    

location /application1/ {
    root   /www/id/html;
    index  index.html index.htm;
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TheAndrey7, 2021-11-07
@12345678XYU87654321

In the direction of alias, see: https://qna.habr.com/q/78932
Nginx is trying to open the /www/id/html/application1/index.html file (the root + path directive from the URL), you can see this in the error log.

A
Alexander Karabanov, 2021-11-07
@karabanov

No need to rack your brains, you need to read the documentation .
Beginner's Guide

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question