Centos7下yum安装nginx
Centos7下启动nginx:
- systemctl start nginx
- systemctl stop nginx
- systemctl restart nginx
Install the prerequisites:
- yum install yum-utils -y
To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
- [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
- [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
By default, the repository for stable nginx packages is used. If you would like to use mainline nginx packages, run the following command:
- yum-config-manager —enable nginx-mainline
To install nginx, run the following command:
- yum -y install nginx
注意配置nginx.conf 将 user=root
