其实很简单:
if ($server_port != ‘80‘ ) { rewrite ^/(.*)$ http://$host/$1 permanent; }
举一反三。。。
if ($server_port != ‘443‘ ) { rewrite ^/(.*)$ https://$host/$1 permanent; }
if ($host != ‘host‘ ) { rewrite ^/(.*)$ http://host/$1 permanent; }
时间: 2024-11-05 02:37:47