I have the following nginx config:
upstream toshiba15 {
server toshiba15.local:80;
}
server {
listen 443 ssl;
server_name my.domain.com;
ssl_certificate /etc/nginx/ssl/startssl-nginx.crt;
ssl_certificate_key /etc/nginx/ssl/startssl-nginx.key;
root /usr/share/nginx/html/;
location /dev/ {
proxy_pass http://toshiba15/;
proxy_redirect http://toshiba15/ /dev/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Mostly works as intended, but one problem- when I specify a nonexistent sub-directory in the uri, it displays the content at the root of the proxied (toshiba15) server!
The proxied server has a stock nginx config- no changes.
EDIT: I resolved the subdomain problem by adding another server that returns 404, and using regexes for my server_names
Additionally, if I specify an undefined subdomain, it redirects to the root of the proxy server (my.domain.com)
Thanks!