- #添加CentOS 7 Nginx yum资源库
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
- #使用命令直接安装
yum install nginx
service nginx start
service nginx stop
service nginx reload
//查看进程apache/httpd
ps -ef | grep nginx
//查看服务端口
netstat -anpl | grep 'nginx'
// rpm方式升级并安装某个版本的Nginx
rpm -Uvh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm
- #配置文件路径
/etc/nginx
-
#启动,直接nginx即可
-
报错:nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory)
cd /usr/local/sbin
nginx
-
centos卸载nginx
-
停止服务
systemctl stop nginx
- 删除find查找到的目录
rm -rf /etc/logrotate.d/nginx
rm -rf /etc/nginx
rm -rf /var/lib/nginx
rm -rf /var/log/nginx
rm -rf /usr/sbin/nginx
rm -rf /usr/lib64/nginx
rm -rf /usr/share/nginx
- yum清理nginx
yum remove -y nginx