Configuring two different application server in one nginx?
You are doing it wrong. How it should be:
server {
listen 192.168.200.173; # public IP address of your server
server_name example.net
location / {
proxy_pass http://example.net;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
send_timeout 900;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 192.168.200.173; # public IP address of your server
server_name example-crm.net
location / {
proxy_pass http://example-crm.net;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
send_timeout 900;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Read how nginx process request: http://nginx.org/en/docs/http/request_processing.html
It short it will find two server for this IP address, then it will check "Host" header in HTTP request and process request in server which have corresponding server_name.