码迷,mamicode.com
首页 > 其他好文 > 详细

nginx 的源码安装

时间:2016-06-28 14:30:02      阅读:146      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!