Centos7安装Nginx

安装openssl 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=<path> option.

需要安装pcre的devel包,pcre-devel。使用yum安装即可:(以下命令还带有ssl、zlib等依赖的安装)

yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel

安装nginx

Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:

cd /usr/local/src

wget http://nginx.org/download/nginx-1.16.1.tar.gz
tar -zxvf nginx-1.1.10.tar.gz
cd nginx-1.1.10
./configure
make
make install

启动

cd usr/local/nginx/sbin

./nginx

停止

./nginx -s stop

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注