nginx开启https parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf
如果您发现本文排版有问题,可以先点击下面的链接切换至老版进行查看!!!
nginx开启https parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf
nginx基本操作
cd /usr/local/nginx/sbin启动开机自动启动./nginx
关闭./nginx -s quit
vim /etc/rc.d/rc.local
在里面添加一行
usr/local/nginx/sbin/nginx
开启SSL
这样你的网站就可以使用https访问了,还会有绿色的代表安全的锁哦 依然是在西部数码申请证书,申请一年只需要8元配置nginx
/usr/local/nginx/conf/nginx.conf 要正确填证书的位置,同时可以开启https和http共存worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80 default backlog=2048;
listen 443 ssl;
server_name www.daozhao.com.cn;
ssl_certificate ssl/www.daozhao.com.cn.cer;
ssl_certificate_key ssl/www.daozhao.com.cn.key;
#ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:3000;
#root /home/node;
#index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
在启动nginx的可能会报错
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf意思就是你的nginx未开启ssl模块 以下内容转载自[https://www.cnblogs.com/piscesLoveCc/p/6120875.html] 解决也比较容易,我们在编译的时候开启http_ssl_module模块就可以了 做个说明:我的nginx的安装目录是/usr/local/nginx这个目录,我的源码包在/usr/local/src/nginx-1.6.2目录 切换到源码包:
cd /usr/local/src/nginx-1.11.3查看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要停止状态)
cp ./objs/nginx /usr/local/nginx/sbin/然后启动nginx,仍可以通过命令查看是否已经加入成功
/usr/local/nginx/sbin/nginx -V
TIPS
如果意外出现443端口被占用的情况nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)可以使用
sudo fuser -k 443/tcp
杀掉占用进程,再启动nginx- 分类:
- Devops
更新时间:
相关文章
curl获取https开头的url的内容
平时我们用curl一般都获取http页面的内容,代码如下 $theurl= "http://www.xx.com"; $_data = array( 'clie 阅读更多…
使用app的华为应用内支付服务还是小心为上,2023年了还有人在支付场景使用http。。。
近期查看邮件的时候发现华为开发者联盟发的一封邮件,大致意思就是出于安全考虑,将于2023年10月1日全面限制应用内支付服务使用HTTP回调地址了。 众所周知HTTP协议以明文方式发送内容,不提供 阅读更多…
axios请求https网站报错Unable to verify the first certificate
今天在使用axios出现了一个错误 Unable to verify the first certificate ,就感觉是证书的问题,自己手动在浏览器中输入https的网站没问题啊,但是在用axi 阅读更多…
amh.sh免费泛域名https证书 自动续期
自己的网站一直使用的https,用ssl证书就是在腾讯云免费申请的,有限期一年,过期了可以再次申请。腾讯云说是有50个免费名额,个人觉得还是够用的。 要说缺点的话也是有的 不能自 阅读更多…
道招网正式开启https
之前我只是对微信小程序好奇,搞了个子域名 https://w.daozhao.com,现在发现越来越多的场景需要https,加上现在的主机貌似只支持一个域名用ssl证书,单独买个多域名ssl证书比较贵 阅读更多…
道招网正式开启https
之前我只是对微信小程序好奇,搞了个子域名 https://w.daozhao.com,现在发现越来越多的场景需要https,加上现在的主机貌似只支持一个域名用ssl证书,单独买个多域名ssl证书比较贵 阅读更多…