centos7下面安装nginx
cd /usr/local/src/ wget http://nginx.org/download/nginx-1.8.1.tar.gz#下载地址 tar zxvf nginx-1.8.1.tar.gz cd nginx-1.8.1
./configure --prefix=/usr/local/nginx configure时提示缺少pcre(nginx依赖pcre ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre= option.
于是安装pcre
yum install pcre Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.opencas.cn * extras: mirrors.sina.cn * updates: mirrors.opencas.cn Package pcre-8.32-15.el7.x86_64 already installed and latest version Nothing to do
结果提示已经安装了
接下来安装pcre-devel
yum install pcre-devel
./configure --prefix=/usr/local/nginx ./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib= option.
yum install zlib zlib-devel
通过,接下来
make && make install
安装成功
接下来启动nginx
/usr/local/nginx/sbin/nginx
启动成功,但是浏览器内不能访问。
注:centos7下默认防火墙要关闭了才能访问,或者添加到规则内。
systemctl stop firewalld.service
看到这个界面表明安装成功!
转载请注明:MitNick » centos7下面安装nginx