When i use curl on localhost its work .
root@ip-10-87-3-236:/etc/nginx# curl -o /dev/null -s -w "%{http_code}\n" http://localhost/ib
Output :
200
But when i connect to browser through internet i am getting
Not Found
The requested resource was not found on this server.
nginx config :
server {
listen 80;
server_name localhost;
location /ib {
proxy_pass http://localhost:3000; #whatever port your app runs on
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Please help here or share any doc that may be very helpful
thanks
CodePudding user response:
You have specified localhost
as your server_name
. If you want to make this work over the internet and / or with your domainname of choise e.g example.com
set the server_name
to the domainname. This will fix your issue.
Reference: https://nginx.org/en/docs/http/ngx_http_core_module.html#server_name