ngix+apache下https配置

环境:wdcp+ngix+apache

ngix同时支持http和https:

1.下载证书,将证书文件放到 /www/wdlinux/nginx/conf目录下

2.修改ngix配置文件
 /www/wdlinux/nginx/conf/vhost/www.xxxxxxx.com.conf

server {
        listen       80;
        listen 443 ssl;
        root /网站目录;
        server_name 域名;
        index  index.html index.php index.htm;
        ssl_certificate zhengshu.crt;
        ssl_certificate_key zhengshu.key;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        .

.

.
}

3.测试无误并重启web服务

/www/wdlinux/nginx/sbin/nginx -t


4.HTTPS服务器优化

cd /www/wdlinux/nginx/conf/

vi nginx.conf

参考:http://blog.csdn.net/mr_raptor/article/details/51854746


5.单页面中配置http自动跳转https方法
在需要强制为https的页面上加入该代码进行处理
<script type=”text/javascript”>
var url = window.location.href;
if (url.indexOf(“https”) < 0) {
url = url.replace(“http:”, “https:”);
window.location.replace(url);
}
</script>


参考:

http://www.cnblogs.com/phpper/p/6441475.html

https://cloud.tencent.com/document/product/400/4143

http://blog.csdn.net/weixin_35884835/article/details/52588157

http://blog.csdn.net/na_tion/article/details/17334669

http://www.cnblogs.com/wjoyxt/p/6102172.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值