Nginx 404 while accessing app

AjaySawant nginx-forum at
Tue Jun 27 14:36:38 UTC 2017

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_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

More information about the nginx mailing list