主题
多域名跳转模板
适合统一主域名、裸域跳转到 www、HTTP 跳转 HTTPS。
替换:
example.comwww.example.com
裸域跳转到 www
nginx
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 http://www.example.com$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name www.example.com;
root /var/www/app/dist;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}HTTP 跳转 HTTPS
nginx
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}