Answer the question
In order to leave comments, you need to log in
Why doesn't the simplest path in nginx work?
Why is localhost/dev not working???
server {
set $path "/media/sf_FunCollection";
listen 1001;
server_name localhost;
if ($http_user_agent ~* "(iphone|android|blackberry)") {
rewrite ^ http://localhost:1100 redirect;
break;
}
location / {
root $path/application;
#index index.html;
charset utf-8;
}
location /dev {
root $path/landings/run;
#index index.html;
charset utf-8;
}
location /api/v1 {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://localhost:1437/api/v1;
}
}
Answer the question
In order to leave comments, you need to log in
You should always look at error.log first.
You also need to understand that the path to the file is added to `root`. Those. the query `localhost/dev/index.html` looks for the file `ROOT/dev/index.html`, which is often overlooked.
And the last, non-obvious moment, the `root` directive is stupid and if it does not see the slash `/` as the first character, then it considers the path relative to some default root. This is usually `/usr/share/nginx` or `/etc/nginx`. In your case, the root would be something like `/usr/share/nginx/media/sf_FunCollection`, which is probably wrong.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question