Welcome! Log In Create A New Profile

Advanced

Nginx 404 while accessing app

June 27, 2017 10:36AM
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?
Subject Author Posted

Nginx 404 while accessing app

AjaySawant June 27, 2017 10:36AM

Re: Nginx 404 while accessing app

tokers June 27, 2017 11:00AM

Re: Nginx 404 while accessing app

tokers June 27, 2017 11:02AM

Re: Nginx 404 while accessing app

AjaySawant June 27, 2017 12:37PM

Re: Nginx 404 while accessing app

AjaySawant June 27, 2017 12:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 172
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready