centos7下安装nginx
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7下安装nginx相关的知识,希望对你有一定的参考价值。
1.从官网(http://nginx.org/)下载安装包
笔者下载版本为nginx-1.10.2.tar.gz
2.使用tar命令解压
tar xvf nginx-1.10.2.tar.gz
cd nginx-1.10.2/
./configure --prefix=/usr/local/nginx (prefix指定安装目录)
注意:在此步骤中因为缺少相关依赖库会出现以下问题:
./configure: error: the HTTP rewrite module requires the PCRE library.
直接安装pcre-devel解决问题
yum -y install pcre-devel
./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
直接安装openssl解决问题
yum -y install openssl openssl-devel
解决上述问题后重新执行
./configure --prefix=/usr/local/nginx
make
make install
3.安装完毕后去安装目录启动Nginx
sh /usr/local/nginx/sbin/nginx
以上是关于centos7下安装nginx的主要内容,如果未能解决你的问题,请参考以下文章