[Ngnix] Building nginx from source

參考連結installing nginx open source

Nginx 官網

選擇mainline, 右鍵複製聯結

http://imgur.com/fJsLuVi

使用wget使令下載原始碼

wget http://nginx.org/download/nginx-1.11.3.tar.gz?_ga=1.218425113.1424501337.1485766539

解壓縮

tar -zxvf http://nginx.org/download/nginx-1.11.3.tar.gz?_ga=1.218425113.1424501337.1485766539

安裝library :
– pcre (ajax)
– libssl (SSL & https)
– zlib1g (壓縮靜態檔案)

sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev

Installation and Compile-Time Options

在你的nginx資料夾下執行configure script, 這段script會產生一個編譯程式碼和安裝nginx所需的Makefile

./configure --sbin-path=/usr/bin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-debug --with-pcre --with-http_ssl_module

其中 --with-http_ssl_module 是使用的模組
nginx module

yourUserName@ubuntu-14:~/nginx-1.11.3$ ls
CHANGES LICENSE README conf contrib man src
CHANGES.ru Makefile auto configure html objs
#執行完畢後, 可看見增加了 Makefile 檔案和 objs 資料夾

接著執行make (compile and install the build):

make
sudo make install

如果沒有make, 先下指令安裝 <code>apt-get install make</code>
關於make可以看鳥哥的介紹
完成後啟動nginx

sudo nginx

就能看見nginx預設畫面了

http://imgur.com/iB9ZD4A

發表留言