Thanks for your help. I'm still struggling with this. I fear I am making it too complicated somehow. I've tried the below but still get a 404 error. Also, while I've got the rewrite logging option enabled, I do not see any of the rewrites being logged in the error log, which makes me wonder if something else is amiss.
location /cama {
rewrite_log on;
rewrite /cama/([^/]+) /$1 break;
proxy_pass http://internalip:port;
}
I've also tried using multiple subdomains (which I'd prefer not to do) using the below. In this case, I don't get any errors but I am always proxied to the internal IP and port referenced in the first server entry regardless of which subdomain I go to.
server {
listen 443;
server_name host1.example.com;
ssl on;
ssl_certificate ssl/myssl.crt;
ssl_certificate_key ssl/myssl.key;
location / {
proxy_set_header Host host1.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://internalip:port;
}
}
server {
listen 443;
server_name host2.example.com;
ssl on;
ssl_certificate ssl/myssl2.crt;
ssl_certificate_key ssl/myssl2.key;
location / {
proxy_set_header Host host2.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://internalip2:port;
}
}
location /cama {
rewrite_log on;
rewrite /cama/([^/]+) /$1 break;
proxy_pass http://internalip:port;
}
I've also tried using multiple subdomains (which I'd prefer not to do) using the below. In this case, I don't get any errors but I am always proxied to the internal IP and port referenced in the first server entry regardless of which subdomain I go to.
server {
listen 443;
server_name host1.example.com;
ssl on;
ssl_certificate ssl/myssl.crt;
ssl_certificate_key ssl/myssl.key;
location / {
proxy_set_header Host host1.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://internalip:port;
}
}
server {
listen 443;
server_name host2.example.com;
ssl on;
ssl_certificate ssl/myssl2.crt;
ssl_certificate_key ssl/myssl2.key;
location / {
proxy_set_header Host host2.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://internalip2:port;
}
}