https改造的.conf文件怎么做

首先我们打开配置文件 pem、key 文件下载好! 然后在80端口配置文件后面增加443端口



server {
        listen       443;
        root /www/web/ziran/xhcss_com/public_html;
        ssl                  on;
        ssl_certificate      cert/www.xhcss.com.pem;
        ssl_certificate_key  cert/www.xhcss.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 www.xhcss.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;
        }
}

然后我们需要把http跳转到https

server {
        listen       80;
        root /www/web/ziran/xhcss_com/public_html;
        server_name www.xhcss.com;
        rewrite ^(.*) https://www.xhcss.com$1 permanent; 
        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;
        }
}


写的好!

微信扫一扫赏大洋