栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Nginx的https配置

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Nginx的https配置

Nginx的https配置

参考地址(阿里云提交的教程链接):
https://help.aliyun.com/document_detail/212905.html?spm=5176.b657008.help.dexternal.14ae1b48aHgR

遇到的错误:
1、nginx: [emerg] the “ssl” parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:99

提示 Nginx 缺少 http_ssl_module 模块。
  • 查看现有模块./nginx -V
  • 添加SSL模块
# 进入Nginx源码目录
cd /usr/local/nginx-1.20.1
 

# 附加--with-http_ssl_module
./configure --with-http_ssl_module
 

# 运行make命令
make



# 备份
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
 

# 停止
./nginx -s stop
 

# 新编译的Nginx覆盖原来的Nginx(注意一定要保证nginx停止了,才能覆盖成功)
cp /usr/local/nginx-1.20.1/objs/nginx /usr/local/nginx/sbin/
 

# 启动Nginx
./nginx
 

# 再次查看已安装模块,确认是否成功
nginx -V

2、nginx: [emerg] no “ssl_certificate” is defined for the “listen … ssl” directive in /usr/local/nginx/conf/nginx.conf:98
nginx.conf文件的https server配置,我使用下面的配置之后就不报错了:

server {
        listen 443 ssl;
        server_name www.zhanjiang.work;

        ssl_certificate      /usr/local/nginx/cert/sslconfigure.pem;
        ssl_certificate_key  /usr/local/nginx/cert/sslconfigure.key;

        #location /api {
        #    rewrite ^/api/(.*)$ /$1 break;
        #    proxy_pass http://zhfk/;
        #    proxy_set_header X-real-ip $remote_addr;
        #}

        location / {
              root   html;
              index  index.html index.htm;
        }

    }
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/512610.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号