Search code examples
node.jsnginxcentosreverse-proxyportforwarding

Nginx reverse proxy mapping does not redirect


I recently started tinkering to solve this problem I was having this problem. So I installed NGINX and set it up so that it forwards the incoming requests on port 80 to port 300 by creating a .conf file in /etc/nginx/conf.d/ location. Here is the configuration file.

server {
    listen 80;

    server_name xyz.xyz;

    location / {
        proxy_pass http://127.0.0.1:300;
        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 hit xyz.xyz I get the default page and when I go to xyz.xyz:300 I get my NodeJS app. Any suggestion?


Solution

  • Seems like it was an issue with SELinux. I just ran this command and it worked.

    setsebool -P httpd_can_network_connect 1