0

I have a few apps running from the same server on different ports, I want to host them on different subdomains, I'm using Nginx, I can get it to work with 1 app, but once I add a second server block both of them get a "connection time out" page in my browser this is what I'm using right now:

server {
listen 80;
server_name sub.domain.com;
location / {
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:8082;
    proxy_redirect off;
  }
}

this works, but If I add another one, both of them stop working.

When I have both it is like this:

server {
listen 80;
server_name sub.domain.com;
location / {
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:8082;
    proxy_redirect off;
  }
}
server {
listen 80;
server_name sub2.domain.com;
location / {
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:8083;
    proxy_redirect off;
  }
}
  • "Nothing works anymore" doesn't really mean anything. You need to be specific about what happens (or didn't happen) and what the configuration was. – Michael Hampton Sep 02 '19 at 08:48
  • Edited, but I get a connection not found page in my browser. – Gido Selten Sep 02 '19 at 08:51
  • I can only see one location block. Please include both the working block, and how it looks after it's not working. Please also include for each a curl showing the response code, error message, server logs, etc. We can help you but we need information to do it. – Tim Sep 02 '19 at 09:03
  • I added block of the settings when it doesn't work, and I only get a connection timed out in my browser, besides that I don't get any other responses – Gido Selten Sep 02 '19 at 09:07
  • Check your DNS records. – Michael Hampton Sep 02 '19 at 09:21
  • what do I need to look for? or what kind of entry should I have? – Gido Selten Sep 02 '19 at 09:23
  • @MichaelHampton what kind of DNS records would I need to check/add? I'm not very familiar with DNS, so I wouldn't know what to do – Gido Selten Sep 02 '19 at 11:04
  • Check that the hostname you are having a problem with has the correct IP address. You used [fake information](https://meta.serverfault.com/q/963), so nobody else can do that for you. – Michael Hampton Sep 02 '19 at 17:08
  • had the same problem... was a broken caa entry on my dns – Cracker0dks Dec 18 '19 at 20:14

0 Answers0