网站补充支持HTTPS(免费方案),并让HTTPS支持伪静态重写

一个客户的网站,要申请小程序,结果后台只认HTTPS开头的网站。

看来都是苹果的标准要普遍化啊。

1:申请 又拍云,亲测可用:

https://www.upyun.com/


1.1控制台-CDN下绑定域名;

域名真实性核验的时候,还需要去解析记录补一个@类型的TXT,官网有帮助,很快

1.2控制台-增值服务-SSL 证书服务

证书类型申请的是:Symantec-TrustAsia DV SSL 单域名证书

当前申请1年确实还免费

申请都通过了就能下载证书,一个RAR有两个文件:crt和KEY,然后拷贝服务器就能用了。


下面两个部分是精华,因为拿了证书不会用还是白瞎,网站上没这个教程。

2:key文件cer文件拷贝到目录

两个目录:

        ssl_certificate C:/key/a.crt;
        ssl_certificate_key C:/key/a.key;

3:NGNIX补充对应伪静态包含的CONF文件。

ngnix.conf下补充这段:

   server {
        listen 443;
        server_name xxxx.com www.xxxx.com;
        ssl on;
        ssl_certificate C:/key/a.crt;
        ssl_certificate_key C:/key/a.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
        ssl_prefer_server_ciphers on;
        root   "D:/phpfind/WWW/spchedao";
        include ecshop.conf;
    index index.html index.htm index.php;
    location ~ \.php$ {
        charset gb2312;
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
 }


附上:CONF文件: 就是上面标红的引用文件,没这个文件https的一些详细页面,伪静态会失效。

if (!-e $request_filename)
{
rewrite ^/index.html$ /index.php last;
rewrite ^/category$ /index.php last;
rewrite ^/feed-c([0-9]+).xml$ /feed.php?cat=$1 last;
rewrite ^/feed-b([0-9]+).xml$ /feed.php?brand=$1 last;
rewrite ^/feed-type([^-]+).xml$ /feed.php?type=$1 last;
rewrite ^/feed.xml$ /feed.php last;
rewrite ^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last;
rewrite ^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*).html$ /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last;
rewrite ^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last;
rewrite ^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*).html$ /category.php?id=$1&brand=$2&page=$3 last;
rewrite ^/category-([0-9]+)-b([0-9]+)(.*).html$ /category.php?id=$1&brand=$2 last;
rewrite ^/category-([0-9]+)(.*).html$ /category.php?id=$1 last;
rewrite ^/goods-([0-9]+)(.*).html$ /goods.php?id=$1 last;
rewrite ^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last;
rewrite ^/article_cat-([0-9]+)-([0-9]+)-(.+)(.*).html$ /article_cat.php?id=$1&page=$2&keywords=$3 last;
rewrite ^/article_cat-([0-9]+)-([0-9]+)(.*).html$ /article_cat.php?id=$1&page=$2 last;
rewrite ^/article_cat-([0-9]+)(.*).html$ /article_cat.php?id=$1 last;
rewrite ^/article-([0-9]+)(.*).html$ /article.php?id=$1 last;
rewrite ^/merchants-([0-9]+)(.*).html$ /merchants.php?id=$1 last;
rewrite ^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)-(([a-zA-Z])+([^-]*)).html /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5&act=$6 last;
rewrite ^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(([a-zA-Z])+([^-]*))(.*).html /brand.php?id=$1&cat=$2&page=$3&act=$4 last;
rewrite ^/brand-([0-9]+)-c([0-9]+)-(([a-zA-Z])+([^-]*))(.*).html /brand.php?id=$1&cat=$2&act=$3 last;
rewrite ^/brand-([0-9]+)-(([a-zA-Z])+([^-]*))(.*).html /brand.php?id=$1&act=$2 last;
rewrite ^/tag-(.*).html /search.php?keywords=$1 last;
rewrite ^/snatch-([0-9]+).html$ /snatch.php?id=$1 last;
rewrite ^/group_buy-([0-9]+).html$ /group_buy.php?act=view&id=$1 last;
rewrite ^/auction-([0-9]+).html$ /auction.php?act=view&id=$1 last;
rewrite ^/exchange-id([0-9]+)(.*).html$ /exchange.php?id=$1&act=view last;
rewrite ^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last;
rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last;
rewrite ^/exchange-([0-9]+)-([0-9]+)(.*).html$ /exchange.php?cat_id=$1&page=$2 last;
rewrite ^/exchange-([0-9]+)(.*).html$ /exchange.php?cat_id=$1 last;



}

猜你喜欢

转载自blog.csdn.net/xocom/article/details/79897400