Nginx 404 while accessing app

Zhang Chao zchao1995 at gmail.com
Tue Jun 27 14:59:41 UTC 2017


Hello!

I copied your configuration, it seems a internal redirection cycled, you
need to modify it(e.g. change the location / to location /=). After i
modified, i didn’t reproduce your problem, the root directive works well.


On 27 June 2017 at 22:36:45, AjaySawant (nginx-forum at forum.nginx.org) wrote:

I have one AngularJS application deployed on port 8080. It can be access as
http://ip:8080. Now I have deployed the application on nginx and I am
trying
to access this application via nginx reverse proxy configuration but I am
getting 404 error in nginx log as it looks like the nginx is searching the
application in wrong directory. My application is in /usr/share/nginx/html
directory but the reverse proxy is looking the app in /etc/nginx/html. Here
is my configuration and I am using Ubuntu 16.04

server {
listen 80 default_server;
server_name _;
location /app/ {
proxy_redirect off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
}

server {
listen 8080;
root /usr/share/nginx/html;
index index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ /index.html;

}
error_page 404 /404.html;
error_page 403 /403.html;
error_page 405 =200 $uri;
}

Can somebody tell me what am I doing wrong?

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,275154,275154#msg-275154

_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170627/77e1bc10/attachment.html>


More information about the nginx mailing list