@
lanternxx 大佬,按照你的写法,除非去除下面的 /匹配,现在总是直接跳转
blog.a.com ,感谢=/没有处于第一优先级匹配,请问下是什么原因啊
server {
server_name
www.a.com a.com;
listen 80 ;
access_log /var/log/nginx/access.log;
location /.well-known/acme-challenge/ {
auth_basic off;
allow all;
root /usr/share/nginx/html;
try_files $uri =404;
break;
}
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
server_name
www.a.com a.com;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_certificate /etc/nginx/certs/www.a.com.crt;
ssl_certificate_key /etc/nginx/certs/www.a.com.key;
add_header Strict-Transport-Security "max-age=31536000" always;
root /home;
location = / {
try_files '' /index.html;
}
location / {
return 301
https://blog.a.com$request_uri;
}
}