安装配置Nginx(Ubuntu18.04)
1、安装Nginx命令
sudo apt update
sudo apt install nginx
2、查看Nginx状态
sudo systemctl status nginx
备注:
active(running)表示安装成功,否则重新安装nginx
3、重启Nginx命令
sudo systemctl restart nginx 或 sudo nginx -s reload
4、停止Nginx命令
sudo systemctl stop nginx 或 sudo service nginx stop
5、卸载Nginx步骤
1)停止Nginx服务
sudo service nginx stop
2)删除Nginx命令
sudo apt-get --purge remove nginx
备注:包括配置文件
3)移除Nginx命令
sudo apt-get autoremove
备注:不使用的软件
4)列出Nginx软件
sudo dpkg --get-selections | grep nginx
备注:与nginx相关的软件
5)删除Nginx软件
sudo apt-get --purge remove nginx
sudo apt-get --purge remove nginx-common
sudo apt-get --purge remove nginx-full
备注:与nginx相关的软件
6)查看Nginx命令
sudo dpkg --get-selections | grep nginx
7)查看Nginx文件
which nginx
备注:查看与Nginx相关文件
8)安装Nginx命令
sudo apt update
sudo apt install nginx
9)重启Nginx服务
sudo systemctl restart nginx 或 sudo nginx -s reload