1.打开网址:http://nginx.org 选择右边的 documentation
2.然后再选择 Installing nginx 然后选择 packages ,选择 CentOS
3.执行命令
sudo yum install yum-utils
4.编辑源
vim /etc/yum.repos.d/nginx.repo
5.复制以下内容到编辑然后保存
[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
6.执行安装
sudo yum install nginx
7.安装完成执行查看配置是否成功
nginx -t
8.查看nginx 状态
systemctl status nginx
9.启动nginx
systemctl start nginx
10.查询nginx运行用户组
ps -ef | grep nginx
11.修改nginx运行用户组,因为需要和php的运行用户组一致
vim /etc/nginx/nignx.conf
user nginx;修改为 user nobody nobody;
保存。
12.重新启动nginx
systemctl stop nginx
systemctl start nginx
13.查看运行用户组
ps -ef | grep nginx
完成
Comments | NOTHING