概述
server {
listen 80;
server_name www.aa.com aa.com bb.aa.com;
#rewrite ^/(.*) https://$server_name$request_uri? permanent; #http重定向到https
#rewrite ^/(.*) https://$server_name$1 permanent; #跳转到Https
#charset koi8-r;
charset utf-8;
if ($host = 'bb.aa.com')
{
rewrite ^/(.*) https://bb.aa.com/$1 permanent;
}
if ($host = 'aa.com')
{
rewrite ^/(.*) https://www.aa.com/$1 permanent;
}
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name www.aa.com aa.com;
#ssl on;
ssl_certificate ./cert/20201111/4750650_www.aa.com.pem;
ssl_certificate_key ./cert/20201111/4750650_www.aa.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://ip:端口号1;
proxy_read_timeout 3000s;
root html;
index index.html;
}
}
server {
listen 443 ssl;
server_name bb.aa.com;
#ssl on;
ssl_certificate ./cert/leadbot/20201117/_bb.aa.com.pem;
ssl_certificate_key ./cert/leadbot/20201117/_bb.aa.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://ip:端口号2;
proxy_read_timeout 3000s;
}
}
最后
以上就是聪慧小蚂蚁为你收集整理的nginx配置多个域名的全部内容,希望文章能够帮你解决nginx配置多个域名所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复