请问一下怎么让http重定向到https和二级域名重定向到顶级域名存在同一个nginx的conf里?
phpcn_u15822017-05-16 13:14:42
HTTP重定向到HTTPS(HTTPS监听443端口。同一端口多个域名的话,需要设置server_name)
server {
listen 80;
server_name domain.com;
rewrite ^(.*)$ https://$host permanent;
}
二级域名重定向到顶级域名:
server {
listen 80;
server_name *.domain.com;
rewrite ^/(.*) http://domain.com/ permanent;
}