I have a NodeJS app on port 8080 and my Nginx file look like this :

server {
        listen 80 default_server;
        listen [::]:80 ipv6only=on;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

location / {
    proxy_pass http://localhost:8080;
    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;

But when I go to : XX.XXX.XXX I have a 403 error, I need to go to : XX.XXX.XXX:8080 What is wrong ?

  • Are there any errors in the logs? Can you open address xx.xxx.xxx:8080 directly in browser? – dmmedia Apr 21 at 17:21
  • yes xx.xxx.xxx:8080 is working, but I need to add ":8080" to get to my website. I want to be on root "xx.xxx.xxx" – GrindCode Apr 21 at 17:23
  • Good, then 403 comes from nginx. Now what about logs? – dmmedia Apr 21 at 17:24
  • 2021/04/21 17:44:16 [error] 28659#28659: *17 access forbidden by rule, client: x.x.x.x, server: _, request: "GET / HTTP/1.1", host: "xx.xx.xx.xx" – GrindCode Apr 21 at 17:45
  • Please see similar issue resolved by changing additional configuration file: serverfault.com/questions/757220/… Probably you have something similar, since you can access port 8080 directly and nginx does not complaint about upstream server inaccessible. – dmmedia Apr 21 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.