在rocky中安装nginx
由于在 rocky 上直接编译 nginx 老报错,所以可以尝试使用如下方式来安装 nginx 。
折叠代码块BASH
复制代码
1 | sudo dnf update |
安装完之后,很可能在反向代理服务时会报502,那么这个可能是开启了 SELinux,可尝试使用如下命令来解决问题(参考了这个文章)。
折叠代码块BASH
复制代码
1 | setsebool -P httpd_can_network_connect true |
如果提示 [emerg] 1862962#1862962: bind() to 0.0.0.0:12355 failed (13: Permission denied)
那么可尝试如下方法
折叠代码块BASH
复制代码
1 | # 临时关闭 SELinux |
一些必要操作
折叠代码块BASH
复制代码
1 | # 设置nginx开机自启动 |
默认安装了nginx后,相关路径解释如下
折叠代码块YAML
复制代码
1 | /usr/sbin/nginx: nginx路径 |
其他使用可参考该篇文章。
相关问题
nginx直接静态托管除
/usr/share/nginx/html下的目录,均报permission denied
暂未解决,直接将静态项目的目录放到/usr/share/nginx/html下即可。相关安装样例模板
可参考 这篇文章
- 本文标题:在rocky中安装nginx
- 创建时间:2024-01-11 21:31:12
- 本文链接:https://blog.212490197.xyz/article/operate-system/rocky/install-nginx-in-rocky/
- 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
复制版权信息
Wow, this guide really saved me! I was stuck for hours trying to figure out why nginx kept throwing 502 errors after installing it on Rocky. The SELinux fix with
setsebooland the explanation about disabling it permanently were absolute gold—I had no idea that was the issue. Also, the step-by-step for opening ports and restarting nginx was super easy to follow. The linked article on Install Nginx on Rocky Linux 9 was so helpful too—honestly, it covered all the little details I was missing. I love this guide and really appreciate how simple you made everything. Thank you so much!I’m delighted to know that my blog has been helpful in resolving your problem. Please accept my apologies for not being able to check the comments regularly. Isn’t the journey towards success truly enjoyable?
v1.5.2