nginx 源码编译

来源:互联网 发布:淘宝怎么修改发票抬头 编辑:程序博客网 时间:2024/06/05 04:11


要在nginx上开发,所以先了解下这个是干嘛的..百度一下很多

编译源码需要的组件

1.zlib

2.pcre

3.openssl

使用ubuntu的话.可以直接使用

sudo apt-get install zlib

sudo apt-get install pcre

sudo apt-get install openssl

这些默认都放在系统目录下.我比较喜欢自己编译

------------------------------------

库下载地址:

源码下载地址 zlib 

http://www.zlib.net/

PCRE --支持正则表达式 

http://www.pcre.org/

opensll安装(可选), 支持安全协议的站点

http://www.openssl.org/

nginx 

http://nginx.org/en/download.html

 

1.编译zlib

tar xvf zlib-1.2.8.tar.gz./configure --static --prefix=/home/charles/flvplay/source/libs/zlibmakemake install

2.编译openssl

tar xvf openssl-1.0.le.tar.gz./config --prefix=/home/charles/flvplay/source/libs/openssl -L/home/charles/flvplay/source/libs/zlib/lib -I/home/charles/flvplay/source/libs/zlib/include threads zlib enable-static-enginemakemake install

3.编译pcre

tar xvf pcre-8.33.tar.gz./configure --prefix=/home/charles/flvplay/source/libs/pcre make make install

4.编译ngnix

复制代码
tar xvf nginx-1.5.4.tar.gz./configure --prefix=/home/charles/flvplay/source/libs/nginx --with-debug --with-openssl=/home/charles/flvplay/source/openssl-1.0.le --with-zlib=/home/charles/flvplay/source/zlib-1.2.8 --with-pcre=/home/charles/flvplay/source/pcre-8.33 --with-http_stub_status_module --with-http_gzip_static_modulemake make install
#备注:--with-openssl --with-zlib --with-pcre这3个路径是他们对应的源码路径..开始我以为是对应库路径.折腾了好久...
复制代码

生成的nginx在/home/charles/flvplay/source/libs/nginx/sbin下

./nginx --运行程序
在地址栏输入: http://localhost 如果看到以下效果,说明正确安装了

 

 

也可以直接下载编写好的Makefile


转载网址:http://www.cnblogs.com/fjchenqian/p/3315042.html



0 0