Nginx配置https过程中出现的问题与解决
目录
- 1.nginx: [emerg]unknown directive35+GAN "ssl" in /usr/local/nginx/conf/nginx.conf:28
- 2.nginx: [warn] the "ssl" directive is deprecated的解决方法
- 3.访问nginx下的图片或者文件的时候出现403 Forbidden nginx/1.22.1
1.nginx: [emerg]unknown directive35+GAN "ssl" in /usr/local/nginx/conf/nginx.conf:28
解决:
出现这个问题的时候可以在你的/usr/local/nginx下输入./sbin/nginx -V检查一下是不是没有配置ssl模块
./sbin/nginx -V
如果没有出现下图,说明你的nginx没有配置ssl模块

配置ssl,到nginx安装目录下
./configure --prefix=/usr/local/nginx --with-http_ssl_module
使用make编译
make
编译完之后是否选择make install可以自己决定,make install 会覆盖之前的nginx
make install
再次通过./sbin/nginx -V检查如果有说明配置成功!
TLS SNI support enabled说明SSL可用,再启动Nginx就正常了

重启nginx
./sbin/nginx -s reload ./sbin/nginx -s quit ./sbin/nginx
2.nginx: [warn] the "ssl" directive is deprecated的解决方法
这个问题是因为升级nginx版本之后,使用之前的配置文件,启动nginx时,出现如下信息:
nginx: [warn] the "ssl" directive is deprecated,use the "listen ... ssl" directive instead in /usr/local/nginx/conf/nginx.conf
解决办法:
进入/usr/local/nginx/conf中修改配置文件nginx.conf,将文件中的ssl on去掉,在listen 443后面加个ssl;

3.访问nginx下的图片或者文件的时候出现403 Forbidden nginx/1.22.1
这个问题可能是因为图片或文件的权限问题,将文件修改成755即可

通过chmod -R 755 filename可以将文件夹下的文件权限一起改成755

栏 目:其它服务器
本文地址:https://zz.feitang.co/server/29918.html
您可能感兴趣的文章
- 01-06nginx从安装到配置详细说明(安装,安全配置,防盗链,动静分离,配置 HTTPS,性能优化)
- 01-06Nginx性能优化之Gzip压缩设置详解(最大程度提高页面打开速度)
- 01-06Linux系统 Centos7.4手动在线升级到Centos7.7
- 01-06详解nginx安装过程并代理下载服务器文件
- 01-06shell脚本根据进程查找指定容器的方法
- 01-06微服务架构拆分策略详解
- 01-06使用 Apache Dubbo 实现远程通信(微服务架构)
- 01-06微服务架构之服务注册与发现功能详解
- 01-06使用Zabbix 5.4.3监控IPMI的方法
- 01-06微服务架构之服务注册与发现实践示例详解






