第一步、查看Nginx的进程
命令 :ps aux | grep nginx
下图表示Nginx启动
下图表示Nginx没有启动
第二步、如果Nginx没有启动就可以跳过这个步骤了;如果是启动状态的话用下面命令进行停止;
先通过可命令1找到对应目录在执行命令2
命令1:cd /usr/local/nginx/sbin
命令2:./nginx -s stop
第三步、查看所有与Nginx有关的文件夹
命令:find / -name nginx
第四步、删除与Nginx有关的文件夹
命令1:rm -rf file /usr/local/nginx*
命令2:find / -name nginx*
第五部、卸载Nginx相关的依赖
命令:yum remove nginx
这样就卸载完成了
卸载Nginx需要命令:
1.查看 Nginx 进程
ps aux | grep nginx
2.启动Nginx的目标目录
cd /usr/local/nginx/sbin
3.关闭Nginx
./nginx -s stop
4.查看与Nginx有关的文件夹
find / -name nginx
5.删除与Nginx有关的文件
命令1:
rm -rf file /usr/local/nginx*
命令2:find / -name nginx*
6.卸载Nginx的依赖
yum remove nginx
安装Nginx需要命令总结:
查看 C++ 环境是否安装(查看版本号)
gcc -v
安装 C++ 环境
yum install gcc-c++ -y
安装 ssl
yum install -y openssl openssl-devel
查看 zlib 是否安装
cat /usr/lib64/pkgconfig/zlib.pc
安装 zlib
yum install -y zlib zlib-devel
查看 pcre 是否安装(查版本号)
pcre-config --version
安装 pcre
yum install -y pcre pcre-devel
下载 Nginx 地址
解压 Nginx 压缩包
tar -xvf nginx-1.18.0.tar.gz
安装 Nginx
进入目录命令
cd nginx-1.18.0
执行命令
./configure
执行make命令
make
执行make install命令
make install
Nginx 服务操作
启动
命令1:
cd /usr/local/nginx/sbin
命令2:./nginx
关闭
命令1:
cd /usr/local/nginx/sbin
命令2:./nginx -s stop
重启
命令1:
cd /usr/local/nginx/sbin
命令2:./nginx -s reload
端口号操作
查询开启的所有端口
firewall-cmd --list-port
设置80端口开启
firewall-cmd --zone=public --add-port=80/tcp --permanent
验证80端口是否开启成功 (单个端口查询)
firewall-cmd --zone=public --query-port=80/tcp
设置80端口关闭
firewall-cmd --zone=public --remove-port=80/tcp --permanent
防火墙操作
检查防火墙是否开启
systemctl status firewalld
开机自启防火墙
systemctl enable firewalld
开机禁止自启防火墙
systemctl disable firewalld
启动
systemctl start firewalld
关闭
systemctl stop firewalld
重启
firewall-cmd --reload
输入IP测试连接