全站https實現某個頁面可以http訪問,其余全部跳轉到https,注意下面的location,如果不加root 配置 找不到這個文件的
server { listen 80; server_name www.test.com; if ($request_uri !~* "/test-site-verification.txt") { rewrite ^(.*)$ https://$host$1 permanent; } location = /test-site-verification.txt { root /data/www/test; } access_log /data/logs/www/test_www_server-301.log; }