1、首先添加一下nginx的官网yum源,命令如下:
vim /etc/yum.repos.d/nginx.repo
- 1
进去加入以下内容,根据你自己的系统选择:
CentOS:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
RHEL:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1
- yum clean all
- yum makecache
- yum search nginx
然后直接yum安装即可,会自动解决依赖问题!
yum install nginx
- 1
添加nginx用户和用户组:
/usr/sbin/groupadd -f www-data
/usr/sbin/useradd -g www-data www-data
- 1
- 2
如果遇到权限问题:
chown -R www-data:www-data /path/to/webserver/www
- 1
yum安装新版本的php7.0:
http://blog.youkuaiyun.com/zhezhebie/article/details/73325663
nginx官网参考链接:
https://www.nginx.com/resources/wiki/start/topics/tutorials/install/