CentOS7 安裝Nginx詳情,centos7nginx詳情

來源:互聯網
上載者:User

CentOS7 安裝Nginx詳情,centos7nginx詳情
Nginx的安裝點擊進入 Ngunx官網下載穩定版本頁面

找到 Pre-Built Packages for Stable version,選擇與自己系統相關的操作,如 CentOS 7,則選擇

To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “6” or “7”, for 6.x or 7.x versions, respectively.

安裝Nginx

[root@localhost ~]# cd /etc/yum.repos.d[root@localhost yum.repos.d]# vim nginx.repo[root@localhost yum.repos.d]# vim nginx.repo # nginx.repo# 需要對上面的源資訊變更 OS=>centos   OSRELEASE=>7[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/7/$basearch/gpgcheck=0enabled=1# 儲存退出# 列出Nginx相關[root@localhost yum.repos.d]# yum list | grep nginx# 安裝Nginx[root@localhost yum.repos.d]# yum install nginx# 查看Nginx版本資訊 (小寫v)[root@localhost yum.repos.d]# nginx -v# 查看Nginx相關參數資訊 (大寫V)[root@localhost yum.repos.d]# nginx -V# 啟動Nginx[root@localhost yum.repos.d]# service nginx start# 或者[root@localhost yum.repos.d]# systemctl start nginx.service# 停止Nginx[root@localhost yum.repos.d]# service nginx stop# 或者[root@localhost yum.repos.d]# systemctl stop nginx.service# 重啟Nginx[root@localhost yum.repos.d]# service nginx restart# 或者[root@localhost yum.repos.d]# systemctl restart nginx.service# 重載Nginx配置,平滑重啟[root@localhost yum.repos.d]# service nginx reload  # 或者[root@localhost yum.repos.d]# systemctl reload nginx.service

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.