开始Nginx的SSL模块

Nginx如果未开启SSL模块,配置Https时提示错误

错误提示:

nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:37

 Nginx开启SSL模块:

cd /usr/local/src/nginx-1.18.0
查看nginx原有的模块:
/usr/local/nginx/sbin/nginx -V
在configure arguments:后面显示的原有的configure参数如下:
--prefix=/usr/local/nginx --with-http_stub_status_module
新配置信息就应该这样写:
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
配置完成后,运行命令:
make
这里不要进行make install,否则就是覆盖安装
然后备份原有已安装好的nginx:
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
然后将刚刚编译好的nginx覆盖掉原有的nginx(这个时候nginx要停止状态)
/usr/local/nginx/sbin/nginx -s quit 正常停止或关闭
/usr/local/nginx/sbin/nginx -s stop 快速停止或关闭
cp ./objs/nginx /usr/local/nginx/sbin/
启动nginx,仍可以通过命令查看是否已经加入成功:
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -V 

Nginx 配置Http和Https共存:
server {
            listen 80 default backlog=2048;
            listen 443 ssl;
            server_name wosign.com;
            root /var/www/html;
  
            ssl_certificate /usr/local/Tengine/sslcrt/ wosign.com.crt;
            ssl_certificate_key /usr/local/Tengine/sslcrt/ wosign.com .Key;
        }
Nginx SSL性能调优:
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;


版权声明:本文为weixin_45177786原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。