Nginx 404 while accessing app

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


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 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
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_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:,275154,275154#msg-275154

nginx mailing list
nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list