Linux - CentOS 7 通過Yum源安裝 Nginx


添加源

sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安裝Nginx

sudo yum install -y nginx

直到出現 Complete! 

啟動

sudo systemctl start nginx.service

啟動后在瀏覽器上訪問,網頁出現以下內容說明安裝成功。

Nginx常用命令

查看版本:nginx -v

查看nginx安裝目錄:ps  -ef | grep nginx

檢查配置文件:nginx -t

啟動:systemctl start nginx.service

停止:systemctl stop nginx.service

重啟:systemctl restart nginx.service

設置開機自啟動:systemctl enable nginx.service

停止開機自啟動:systemctl disable nginx.service

查看當前狀態:systemctl status nginx.service

查看所有已啟動的服務:systemctl list-units --type=service


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM