sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum install -y nginx
直到出現 Complete! nginx
sudo systemctl start nginx.service
啓動後在瀏覽器上訪問,網頁出現如下內容說明安裝成功。centos
查看版本:nginx -v瀏覽器
查看nginx安裝目錄:ps -ef | grep nginxspa
檢查配置文件:nginx -trest
啓動:systemctl start nginx.servicecode
中止:systemctl stop nginx.serviceblog
重啓:systemctl restart nginx.serviceit
設置開機自啓動:systemctl enable nginx.serviceclass
中止開機自啓動:systemctl disable nginx.service配置
查看當前狀態:systemctl status nginx.service
查看全部已啓動的服務:systemctl list-units --type=service