Upstream Uat_appnew {
Server 192.168.248.4:8081;
}
Upstream Uat_app {
Server 192.168.248.4:8080;
}
server {
Listen 80;
server_name www.zzh.com;
CharSet GBK;
Access_log/var/log/nginx/host.access.log main;
Rewrite ^ (. *) https://$server _name$request_uri permanent;
}
server {
Listen 443;
server_name www.zzh.com;
CharSet GBK;
Access_log/var/log/nginx/host.access.log main;
Add_header x-frame-options "Sameorigin";
Location/{
Rewrite ^/$ https://$server _name/estore/permanent;
#root/usr/share/nginx/html;
#index index.html index.htm;
Proxy_max_temp_file_size 0k;
#proxy_http_version 1.1;
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_set_header x-frame-options Sameorigin;
#proxy_set_header strict-transport-security "max-age=63072000; Includesubdomains; Preload ";
Add_header strict-transport-security "max-age=63072000; Includesubdomains; Preload ";
Add_header x-frame-options "Sameorigin";
Proxy_pass Http://uat_app;
}
Location ~/estorenew {
#rewrite ^/$ https://$server _name/estorenew/permanent;
#root/usr/share/nginx/html;
#index index.html index.htm;
Proxy_max_temp_file_size 0k;
#proxy_http_version 1.1;
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_set_header x-frame-options Sameorigin;
#proxy_set_header strict-transport-security "max-age=63072000; Includesubdomains; Preload ";
Add_header strict-transport-security "max-age=63072000; Includesubdomains; Preload ";
Add_header x-frame-options "Sameorigin";
Proxy_pass http://uat_appnew;
}
#error_page 404/404.html;
# REDIRECT Server error pages to the static page/50x.html
#
Error_page 502 503 504/50x.html;
Location =/50x.html {
root/usr/share/nginx/html;
}
# Proxy The PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# Proxy_pass http://127.0.0.1;
#}
# Deny access to. htaccess files, if Apache ' s document Root
# concurs with Nginx ' s one
#
#location ~/\.ht {
# Deny All;
#}
}
This article is from the "Freeterman" blog, make sure to keep this source http://myunix.blog.51cto.com/191254/1834926
Nginx with domain name different suffix connection different backend app