1. 備份原來的yum源 $sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo-backup 2.設置aliyun的yum源 $sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 3.添加EPEL源 $sudo wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo 4.清理緩存,生成新緩存,執行yum系統更新 $sudo yum clean all $sudo yum makecache $sudo yum update(可選)
------------------------------------------------------------------------------------------------------------------------------------------
1,安裝nginx
yum install nginx -y
2,nginx使用
systemctl start nginx.service systemctl stop nginx.service systemctl reload nginx.service systemctl status nginx.service
3.刪除Nginx的自動啟動
chkconfig nginx off
4.從源頭刪除Nginx
rm -rf /usr/sbin/nginx
rm -rf /etc/nginx
rm -rf /etc/init.d/nginx
5.再使用yum清理
yum remove nginx
6,端口查看
命令2:netstat -antp | grep :80(查看80端口被哪個服務占用)or netstat -antpuel | grep ":22" | grep -v grep(過慮grep本身)
命令3:netstat -antp | grep :(查看所有端口占用情況)
命令4:ps aux | grep nginx(查看nginx進程運行狀態)or ps aux | grep :80 | grep -v grep(過慮grep本身)
7、殺掉進程命令
a)相關nginx進行全部殺掉:killall -9 nginx
b)把PID兩個進程殺掉:kill -9 pid1 and kill -9 pid1
8、查看版本
命令:nginx -V