I have a problem I hope some can help me with.
I have an domain name pointing to a webserver (Pine64). The server is running some php.
Now I want to connect another physical webserver to the same domain but as a subdomain.
Both servers are running Debian with nginx, php and forced ssl.
So basically I need the following:
Https: // mydomain.name -> Pine64 server port 443 (ssl) Https: // srv2.mydomain.name -> second local server post 443 (ssl)
Is it possible?
All examples I have found so far is for virtual domains on the same server
you only need a separate domain config ( considering future maintain) like this,
create a config file in /etc/nginx/sites-enabled/srv2.mydomain.name
with a content similar as below,
server {
listen 80; # or 443 ssl related settings
server_name srv2.mydomain.name; # note this part
location / {
proxy_pass http://127.0.0.1:8000$request_uri; # forward request to the server running on this ip:port
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# any other conf part
}