sudo yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2、yum中添加nginx(直接安装的时候报 :有可用软件包 nginx)
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
3、安装
sudo yum install nginx
完毕后,就能看到/etc/nginx目录。
=====================================================================================================
也可用另方法yum安装【见http://jingyan.baidu.com/article/aa6a2c14dc36640d4d19c47e.html】
1:wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm //下载nginx包
2:rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm //建立nginx的yum仓库
3:yum install nginx //安装
4、curl localhost
如果出现 <title>Welcome to nginx!</title> 就是安装成功
5、重新加载配置文件
nginx -s reload
6、启动nginx
systemctl start nginx
PS:指定配置文件
nginx -c nginx.conf