为wdcp站点开启SSL支持
随着https的流行,现在开发微信小程序也要求必须是https站点了。研究了一下wdcp如何支持ssl
第一步:申请ssl证书
- 到阿里云申请免费的ssl证书
第二步:将生成的ssl证书上传到/www/wdlinux/nginx/conf/cert/目录
第三步:修改站点的nginx配置
server { listen 443; root /home/wwwroot/el0310/public_html; ssl on; ssl_certificate cert/el0310.com.pem; ssl_certificate_key cert/el0310.com.key; ssl_prefer_server_ciphers on; ssl_session_timeout 10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; server_name el0310.com www.el0310.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; location ~ \.php$ { proxy_pass http://127.0.0.1:88; include naproxy.conf; } location ~ /\.ht { deny all; } location / { try_files $uri @apache; } location @apache { internal; proxy_pass http://127.0.0.1:88; include naproxy.conf; } }
与ssl相关的都加上,端口改为443
第四步:http访问自动跳转到https
server { listen 80; root /home/wwwroot/el0310/public_html; server_name el0310.com www.el0310.com; rewrite ^(.*)$ https://$host$1 permanent; }
将上面的代码添加到nginx配置最上方
<< 上一篇
下一篇 >>