小程序配置https

问题:

1. 微信开发者工具中,通过不检验域名可以访问,手机预览访问不了的
-- 添加配置https的域名访问

申请https证书:

阿里云购买免费证书:
控制台-安全(云盾)-CA证书服务-购买-一个域名&Symantec-购买

nginx配置https:

#ci server=======start
    server {
        listen 80;
        #listen 443 ssl;
        server_name ci.mag998.com;
        
        root   /mnt/html/ci;
        index  index.php index.html index.htm;
        
        #ssl_certificate /usr/local/nginx/cert/214130435490250.pem;
        #ssl_certificate_key /usr/local/nginx/cert/214130435490250.key;

        location / {

            if (!-e $request_filename){
                rewrite ^/(.*) /index.php last;
            }
        }
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
            include        fastcgi_params;
        }
        location ~ /\.ht {
            deny  all;
        }
    }
    #ci end============

小程序后台:

设置-开发设置-服务器域名-添加域名

猜你喜欢

转载自www.cnblogs.com/maoriaty/p/9111344.html