欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Nginx多域名HTTPS配置

程序员文章站 2022-07-12 22:29:38
...
server {
        listen 80;
        server_name 域名1.com;		
        rewrite ^(.*)$   	https://域名1$1 permanent;
}
server {
	listen 80;
	server_name 域名2.com;
	rewrite ^(.*)$		https://域名2$1 permanent;
}
server {
        listen       443 ssl;
        server_name  域名1.com 域名2.com;

        ssl_certificate      /opt/nginx_ssl/214543424600682.pem;
        ssl_certificate_key  /opt/nginx_ssl/214543424600682.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

	location ~ .*\.(gif|jpg|png|css|js|flv|ico|swf|eot|ttf|otf|woff|svg)(.*)
	{		
		proxy_cache		cache_one;
		include 		/opt/nginx_conf/include_cache.conf;
		proxy_pass 		http://test;
	}
		
	location /
	{  
		proxy_pass		http://test;
	}        
}

域名1/域名2均不带.com、http://、https://

如果有什么问题请指出,怕误导大家