CentOs 7 安装/卸载Nginx
一、安装
- 添加Nginx存储库
sudo yum -y install epel-release
- 安装Nginx
sudo yum -y install nginx
- 启动Nginx
sudo systemctl start nginx
- 增加nginx配置 允许http, https通信
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
- 重启防火墙
sudo firewall-cmd --reload
- nginx开机自启
sudo systemctl enable nginx
卸载
- 停止Nginx
sudo systemctl stop nginx
- 关闭nginx自启
chkconfig nginx off
- 查看nginx目录
whereis nginx
- 删除nginx
rm -rf /usr/sbin/nginx /etc/nginx /etc/init.d/nginx
- 用yum 卸载nginx
yum remove nginx
异常解决
- user 用户改为root用户
user root;
- 解决nginx转发请求异常的解决办法
setsebool -P httpd_can_network_connect 1