Score:0

Everything points to reverse proxy

cn flag

I have several domains on the same server i.e IP address, but they all show the reverse proxy.

When I type in example1.com and example2.com, they both go to the reverse proxy for someapp.com

Here's the nginx.conf file

  # someapp.com
  server {
    listen 80;
    server_name someapp.com;
    return 301 https://someapp.com$request_uri;
  }

  server {
    listen 443 ssl;

    server_name someapp.com;

    ssl_certificate /etc/letsencrypt/live/someapp.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/someapp.com/privkey.pem;

    location / {
      proxy_pass 'http://localhost:3000/';
    }

    location /pics/ {
      root /home/user;
      try_files $uri $uri/ =404;
    }
  }

  # example1.com ######################################

  server {
    listen 80;
    server_name example1.com;
    location / {
       proxy_pass 'http://127.0.0.1:5000';
    }
  }

  # example2.com ######################################

  server {
    listen 80;
    server_name example2.com;
    root /home/user/example2;
    index index.html;
    location / {
        try_files $uri $uri/ =404;
    }
  }

EDIT:

When I type example1.com it goes to ~~https~~://someapp.com

When I type http://example1.com it goes to example1.com

What gives?

Score:0
in flag

in my mind you want to https://someapp.com redirection , example1.com go to http://example1.com and example2.com goes http://example2.com

#Someapp.com
server {
   server_name someapp.com;
   location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
   }
   location /pics/ {
      root /home/user;
      try_files $uri $uri/ =404;
    }
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/someapp.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/someapp.com/privkey.pem;

}
# example1.com ######################################
server {
    listen 80;
    server_name example1.com;
    location / {
       proxy_pass 'http://127.0.0.1:5000';
       proxy_http_version 1.1;
       proxy_set_header Host $host;
   }
}

# example2.com ######################################
server {
    listen 80;
    server_name example2.com;
    root /home/user/example2;
    index index.html;
    location / {
        try_files $uri $uri/ =404;
    }
}

#someapp.com - Redirection
server {
    if ($host = someapp.com) {
    #rewrite ^/(.*)$ https://$host/$1 permanent;
        return 301 https://$host$request_uri;
    } 
server_name someapp.com;
    listen 80;
    return 404; 
}
Score:-1
cn flag

Turns out the problem was due to the SSL certificate, meaning both example1.com and example2.com need their own certificates.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.