reverse proxy multiple subdomains problems
c0mputerking
nginx-forum at forum.nginx.org
Mon Sep 3 20:07:49 UTC 2018
I am trying to do a redirect from http and a reverse proxy to my apache web
server. I would like to include several subdomains, they all have dns
records and apache virtual hosts setup on the other end. However no matter
which of the 3 subdomains i try i always end up at https://my-site.com this
is fine for www.my-site.com but recipes.my-site.com is a supposed to be a
different website all together.
I am new with nginx and have a hunch that it may have something to do with
$server_name$request_uri not being the right option in my case but i'm not
sure see config below
server {
listen 172.16.0.10:80;
server_name my-site.com www.my-site.com recipes.my-site.com;
return 301 https://$server_name$request_uri;
}
server {
listen 172.16.0.10:443 ssl;
server_name my-site.com www.my-site.com recipes.my-site.com;
access_log /var/log/nginx/van-ginneken.com-access.log;
ssl_certificate /root/SYNC-certs/van-ginneken.com/fullchain.pem;
ssl_certificate_key /root/SYNC-certs/van-ginneken.com/privkey.pem;
set $upstream 172.16.0.13;
location / {
proxy_pass_header Authorization;
proxy_pass https://$upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
}
}
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,281086,281086#msg-281086
More information about the nginx
mailing list