centos7下安裝nginx

1.安裝nginx依賴
sudo yum install yum-utils
2.建立yum存儲庫的nginx源文件
vi /etc/yum.repos.d/nginx.repo

將下列內容寫入nginx.repo文件中nginx

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
3.安裝nginx
sudo yum install nginx -y

說明:-y 爲忽略問詢選項自動安裝,若要接受步驟問詢可不帶本參數centos

4.啓動nginx
sudo systemctl start nginx.service
相關文章
相關標籤/搜索