Certified Reverse Proxy
Server
{
Listen 443 SSL;
SSL on;
SSL_CERTIFICATE/USR/LOCAL/NGINX/SSL/CN.CRT;
Ssl_certificate_key/usr/local/nginx/ssl/cn.key;
server_name www.aa.com;
Location/{
# proxy_redirect off;
# Proxy_set_header Host $host;
# Proxy_set_header X-real-ip $remote _addr;
# Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
Include proxy_setting.conf;
# Proxy_next_upstream Error timeout Invalid_header http_500 http_502 http_503;
#
# # # # Set Headers # # #
# Proxy_set_header Host $host;
# Proxy_set_header X-real-ip $remote _addr;
# Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
#
# # # Most PHP, Python, Rails, Java apps can use this header # # #
# Proxy_set_header X-forwarded-proto HTTPS;
#
# # # By default we don ' t want to redirect it # # # #
# proxy_redirect off;
Proxy_pass HTTPS://SSL1;
}
}
proxy_setting.conf Content
Proxy_redirect off;
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_cache_use_stale timeout http_502 http_504;
Proxy_cache_use_stale updating error timeout;
Proxy_set_header X-forwarded-proto HTTPS;
Proxy_ignore_headers x-accel-expires Expires Cache-control Set-cookie;
Add_header X-cache ' $upstream _cache_status from $server _addr ';
Proxy_max_temp_file_size 0;
Proxy_connect_timeout 5;
Proxy_send_timeout 5;
Proxy_read_timeout 3;
Proxy_buffer_size 4k;
Proxy_buffers 4 32k;
Proxy_busy_buffers_size 64k;
Proxy_temp_file_write_size 64k;
Reverse Proxy
~
Server
{
Listen 80;
server_name api.aaa.com;
Location/{
# proxy_redirect off;
# Proxy_set_header Host $host;
# Proxy_set_header X-real-ip $remote _addr;
# Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
Include proxy_setting.conf;
Proxy_pass Http://online;
}
Access_log/data/wwwlogs/api.log access;
}
The main difference is bold font other uses proxy_setting.conf file can be
This article is from the "Learn Linux" blog, so be sure to keep this source http://10265013.blog.51cto.com/10255013/1834912
Nginx reverse Proxy and authentication reverse proxy