首页 > 其他 > 详细

nginx 的源码安装

时间:2016-06-28 14:28:41      阅读:147      评论:0      收藏:0      [点我收藏+]

安装nginx之前要做的准备工作有:安装如下库

(1)gzip模块需要 zlib 库

(2)rewrite模块需要 pcre 库

(3)ssl 功能需要openssl库

1~pcre的安装:

我们可以之间yum 安装

yum -y install pcre*

或者源码安装

cd /usr/local/src

wget https://sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.gz/download

tar xf  pcre-8.39.tar.gz

cd pcre-8.39

./configure

make

make install

 

 

2~openssl的安装

需要ssl的支持,如果不需要,跳过这一步,

yum   安装

yum -y install openssl*

源码安装

wget   ftp://ftp.openssl.org/source/openssl-1.0.1t.tar.gz

tar xf

cd

./config

make && make install

 

 

 

 

 

 

 

 

 

3.zlib的编译安装:

wget  http://zlib.net/zlib.1.2.8.tar.gz

tar  xf

cd

./configure

make && make install

 

 

 

4~重头戏来了,nginx的编译安装

wget   http://nginx.org/download/nginx-1.10.1.tar.gz

groupadd nginx

useradd nginx -g nginx

tar xf nginx-1.10.1.tar.gz

./configure --prefix=/usr/local/nginx  --user=nginx   --group=nginx --with-http_ssl_module   --with-http_stub_status_module --with-pcre

下面解释一下

--with-pcre:为了支持rewrite重写功能,必须制定pcre

--with-http_stub_status_module:支持nginx状态查询

--with-http_ssl_module:支持https

最后执行:make   && make install

至此nginx  就安装完成了

nginx的启动方式为

cd /usr/local/nginx/sbin/

./nginx -s start |  stop     |       restart    |     reload

nginx 的源码安装

原文:http://www.cnblogs.com/smail-bao/p/5623286.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!