Monday 25 September 2017

multiple sites behind a nginx reverse proxy?

Hi, my default file looks like thisserver { listen 80; server_name firstdomain.com; location / { proxy_pass http://myip:8000; 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; } } I have a 2nd node.js app running on port 4000, if i go to firstdomain.com:4000, I see it.However, I also setupseconddomain.conf as follows server { listen 80; server_name seconddomain.com www.seconddomain.com; location / { proxy_pass http://myip:4000; 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; } } the problem is when I go to seconddomain.com, it goes to my default app on port 8000.I tried to remove default, and add a firstdomain.conf file, but that did not work either.any ideas on why this could be happening or what i'm missing?I am tempted to use something like thishttps://github.com/OptimalBits/redbird

Submitted September 25, 2017 at 06:55PM by sayurichick

No comments:

Post a Comment