安装ssl证书开启https加密访问以后最大的特点是443端口https页面跳转访问80端口的http页面..
网上看了很多教程都是各种设置,但是没有一个成功的..
最后去老外的网站找到了这个伪静态规则,亲测效果很好.
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
关于nginx的伪静态规则:
server {
listen 443;
root /www/web/guwanlife/public_html;
server_name www.ampc8.com www.ampc8.com;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
ssl on;
ssl_certificate_key /www/wdlinux/nginx/conf/pastdust.key;
ssl_certificate /www/wdlinux/nginx/conf/pastdust.crt;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ /\.ht {
deny all;
}
include /www/wdlinux/wdcp/rewrite/dzx32_nginx.conf;
}
server {
listen 80;
server_name www.testcom;
return 301 https://$server_name$request_uri;
} |