centos7 下nginx的yum安裝

1 添加CentOS 7 Nginx yum資源庫,打開終端,使用如下命令:nginx

[root@iz2zehbmmjvren7bs4we3xz/]#rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpmcentos

Retrieving http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm服務器

warning: /var/tmp/rpm-tmp.Khjjps: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY資源

Preparing...                          ################################# [100%]get

Updating / installing...ast

   1:nginx-release-centos-7-0.el7.ngx ################################# [100%]test

[root@iz2zehbmmjvren7bs4we3xz /]#date

 

2.安裝Nginxplugin

在你的CentOS 7 服務器中使用yum命令從Nginx源服務器中獲取來安裝Nginx:service

[root@iz2zehbmmjvren7bs4we3xz /]# yum install -y nginx

Loaded plugins: fastestmirror

base                                                                                                                                   | 3.6 kB  00:00:00    

epel                                                                                                                                   | 4.3 kB  00:00:00    

extras                                                                                                                                 | 3.4 kB  00:00:00    

nginx                                                                                                                                  | 2.9 kB  00:00:00    

updates                 

3 啓動nginx

剛安裝的Nginx不會自行啓動。運行Nginx:

systemctl start nginx.service

4 CentOS 7 開機啓動Nginx

[root@iz2zehbmmjvren7bs4we3xz /]# systemctl enable nginx.service

Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

相關文章
相關標籤/搜索