Board logo

标题: [教程] lanmp中http转到https方法 [打印本页]

作者: weigc    时间: 2018-6-24 11:54     标题: lanmp中http转到https方法

自己做个脚印!写好了!每次有新站都会忘记写法!都来论坛查找!都没有!自己写下以后好弄前提上传好自己的证书到/www/wdlinux/nginx-1.8.1/conf/cert里
编辑对应的nginx配置文件


  1. server {        listen       80;        listen       443;//两个端口在一起        root /www/web/your_domian/public_html;        ssl                  on;        ssl_certificate      cert/your_domian.crt;        ssl_certificate_key  cert/your_domian.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 your_domian www.your_domian;        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;                if ($host ~* "^mtservers.cn$") {    rewrite ^/(.*)$ https://www.your_domian.cn/ permanent; //正则匹配 这个是多个域名可以跳转    }        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;        }}
复制代码



your_domian.cn 改成自己的域名
不知道怎么的!用后台的强制启用https会造成网站打不开!只好用这个了!编辑完后上传到/www/wdlinux/nginx-1.8.1/conf/vhost配置目录里!记得网站列表里!网站不能编辑!编辑后!这个配置就会被重制!只能再次配置!最后重启下web就好了




欢迎光临 WDlinux官方论坛 (http://www.wdlinux.cn/bbs/) Powered by Discuz! 7.2