(原)nginx 源碼編譯

要在nginx上開發,因此先了解下這個是幹嗎的..百度一下不少html

編譯源碼須要的組件nginx

1.zlibgit

2.pcregithub

3.openssl正則表達式

使用ubuntu的話.能夠直接使用ubuntu

sudo apt-get install zlib安全

sudo apt-get install pcreless

sudo apt-get install opensslspa

這些默認都放在系統目錄下.我比較喜歡本身編譯.net

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

庫下載地址:

源碼下載地址 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/zlib
make
make 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-engine
make
make 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_module
make 
make install
#備註:--with-openssl --with-zlib --with-pcre這3個路徑是他們對應的源碼路徑..開始我覺得是對應庫路徑.折騰了很久...

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

./nginx --運行程序
在地址欄輸入: http://localhost 若是看到如下效果,說明正確安裝了

 

 

也能夠直接下載編寫好的Makefile

下載地址:

https://github.com/charlessoft/flvplay

相關文章
相關標籤/搜索