nginx 配置SSH

1、上传ssl证书到服务器/usr/local/nginx/ssl/xxx.pfx
2、执行命令:
openssl pkcs12 -in /usr/local/nginx/ssl/xxxx.pfx -nocerts -nodes -out /usr/local/nginx/ssl/xxxx.key
输入密码:
3、执行命令:
openssl pkcs12 -in /usr/local/nginx/ssl/xxxx.pfx -clcerts -nokeys -out /usr/local/nginx/ssl/xxxx.crt
输入密码:
4、修改nginx.conf

server {
                listen       443;
                server_name xxxx.com.cn;
                index index.html index.htm index.php;
                root  /home/wwwroot/xxxx;
                ssl on;
                ssl_certificate   /usr/local/nginx/ssl/xxxx.crt;
                ssl_certificate_key  /usr/local/nginx/ssl/xxxx.key;
                ssl_session_timeout 5m;
                ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                ssl_prefer_server_ciphers on;

                include enable-php.conf;


                location / {
                        if (!-e $request_filename) {
                                rewrite ^/(.*)$ /?s=$1 last;
                         }
                 }

                access_log  /home/wwwlogs/access.log;

        }

5、重载nginx
nginx -t
nginx -s reload

但是,安装后安卓微信访问时白屏,安卓浏览器访问时,提示是“不安全的证书”。
是因为“证书链不完整”。在cret中添加“中级证书”后就好了

你可能感兴趣的:(centos,nginx)