码迷,mamicode.com
首页 > 其他好文 > 详细

记录一个nginx的proxy_pass

时间:2018-07-26 18:40:00      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:home   lis   access   sha   war   cat   protocol   rect   protoc   

server {
	listen 80;
	server_name www.hw801.com;
	server_name_in_redirect off;
	access_log  /home/logs/nginx/www.hw801.com/access_log main;
        error_log  /home/logs/nginx/www.hw801.com/error_log;
	log_not_found on;

	location / {
		proxy_read_timeout      300;
		proxy_connect_timeout   300;
		proxy_redirect          off;
		proxy_http_version 1.1;
		proxy_pass				http://10.10.10.12;
		proxy_set_header    Host                $host;
		proxy_set_header    X-Real-IP           $remote_addr;
		proxy_set_header    X-Forwarded-Ssl     on;
		proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
	}
}

server {
	listen 443 ssl;
        server_name www.hw801.com;
	server_name_in_redirect off;
	#ssl			on;
	ssl_certificate		certs/hw801.com.crt;
	ssl_certificate_key	certs/hw801.com.key;
	ssl_protocols		TLSv1 TLSv1.1 TLSv1.2;
	ssl_ciphers		"ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RS
A-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DE
S-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
	#ssl_prefer_server_ciphers	on;
	ssl_session_cache		shared:SSL:10m;
	ssl_session_timeout		10m;
        access_log  /home/logs/nginx/www.hw801.com/access443_log main;
        error_log  /home/logs/nginx/www.hw801.com/error443_log;
	log_not_found on;
	location / {
		proxy_read_timeout      300;
		proxy_connect_timeout   300;
		proxy_redirect          off;
		proxy_http_version 1.1;
		proxy_pass				http://10.10.10.12;
		proxy_set_header    Host                $host;
		proxy_set_header    X-Real-IP           $remote_addr;
		proxy_set_header    X-Forwarded-Ssl     on;
		proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
		proxy_set_header    X-Forwarded-Proto   https;
		proxy_set_header    X-Forwarded-Port    443;
	}
}     

可增加80强制443

	if ($scheme != https) {
		rewrite ^(.+)$ https://$host$1 permanent;
	}

  

 

记录一个nginx的proxy_pass

标签:home   lis   access   sha   war   cat   protocol   rect   protoc   

原文地址:https://www.cnblogs.com/xzlive/p/9372835.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!