Search code examples
node.jsnginxreverse-proxynginx-reverse-proxycentos-web-panel

Nginx reverse proxy not working on domain name


I have tried all the solution on SO but no success. I want to use Nginx as a "Node.js" app reverse proxy. With my current configurations, I was able to make it work when connecting to it through the server IP but not when using its domain name.My configuration details pastebin.com/gMqpmDwj

http://Ipaddress:3000 works but http://example.com doesn't.

Here is the configuration of my Nginx proxy, stored in /etc/Nginx/conf.d/domain.conf.

server {
    listen 80;
    server_name domain_name;

    location / {
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         http://ipaddress:3000;
    }
}

But when I try to access it works fine on ip:port but when on domain:port or without port it doesn't


Solution

  • I solved my issue after following this link.I had multiple configuration files active that was causing problem. How to Configure Nginx Reverse Proxy for Nodejs on Centos