0

I'm planning make two websites in same machine. Which first website running on port 8433 and second website running on port 9433

Im using ubuntu 20.04 Assume i have two domains, let's say foo.me and bar.me Both domain is pointed to same public IP and different SSL.

consider there's an incoming request to port 80 or 443

if HTTP header contain foo.me then the request will forward to port 8433

if HTTP header contain bar.me then the request will forward to 9433.

  • What's your software stack? On linux the above can be achieved with haproxy, nginx, traefik, kong, many other proxies or traffic routers/ingress controllers with varying levels of complexity. Is your goal minimal solution? or long term management, support and monitoring quality of service? – Egidijus Oct 20 '21 at 11:44
  • Does this answer your question? [How can I forward requests from my web server?](https://serverfault.com/questions/1035016/how-can-i-forward-requests-from-my-web-server) – Gerald Schneider Oct 20 '21 at 12:50
  • My first website is using apache-php and second website is using nodejs. Should i migrate to nginx and remove apache, i'm using linux. The link above you share to me im not sure if its work using two domain. Yes long term – Muhammad Ikhwan Perwira Oct 20 '21 at 13:03

1 Answers1

1

as you have two https sites you need to have two virtual hosts so no need to examine http header again. As in reply pointed by Gerald above the best is to setup it this way (for nginx):

server {
  listen 443;
  server_name foo.me;
  root /var/www/html;
  
  # SSL options left out for simplicity

  location / {
    proxy_pass http://localhost:8433/;
  }
}

server {
  listen 443;
  server_name bar.me;
  
  # SSL options left out for simplicity
  
  location / {
    proxy_pass http://localhost:9433/;
  }
}

same for port 80 - hust replace number in "listen" and don't put SSL related directives