野生大熊猫

Nginx配置HTTPS
首先博主这边使用的wdcp,默认使用的是Nginx。在文件夹/www/wdlinux/nginx/conf/vho...
扫描右侧二维码阅读全文
09
2018/03

Nginx配置HTTPS

首先博主这边使用的wdcp,默认使用的是Nginx
在文件夹/www/wdlinux/nginx/conf/vhost中创建文件ssl.aaa.conf

server {
        listen       443;
        root /home/web/aaa/public_html;
        server_name aaa.com  www.aaa.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;
        
        #ssl on;
        ssl_certificate /www/wdlinux/nginx/conf/cert/aaa.crt;#或者是aaa.pem
        ssl_certificate_key /www/wdlinux/nginx/conf/cert/aaa.key;
        #ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
        #ssl_prefer_server_ciphers on;
        #ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        keepalive_timeout 70;
        ssl_session_cache shared:SSL:20m;
        ssl_session_timeout 10m;
        #ssl_dhparam /etc/ssl/certs/dhparam.pem;

        location ~ \.php$ {
                proxy_pass http://127.0.0.1:88;
                include naproxy.conf;
        }
        location ~ /\.ht {
                deny  all;
        }
        location / {
                try_files $uri @apache;
        }
        location @apache {
                 proxy_pass http://127.0.0.1:88;
                 include naproxy.conf;
        }
        if ($host = 'aaa.com'){
        rewrite ^/(.*)$ https://www.aaa.com/$1 permanent; 
        }
}

配置好后重启Nginx

/www/wdlinux/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok  
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful (显示表示配置文件没有错误)
Last modification:March 9th, 2018 at 12:29 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment