linux/macbook 編譯安裝nginx(通用版本)

準備材料:

1. nginx源碼

2. pcre(下載後解壓即可)

3. zlib(下載後解壓即可)

安裝步驟:

1. 寫個configuration,如下:

./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--with-http_dav_module \
--with-http_flv_module \
--with-http_realip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-pcre=../pcre-8.43 \
--with-zlib=../zlib-1.2.11 \
--with-debug \
--http-client-body-temp-path=/var/tmp/nginx/client \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi

這麼多參數的意思是啥?看下面

# 這些都是我抄的,出了啥事別找我^_^
--prefix #nginx安裝目錄,默認在/usr/local/nginx
--pid-path #pid問件位置,默認在logs目錄
--lock-path #lock問件位置,默認在logs目錄
--with-http_ssl_module #開啓HTTP SSL模塊,以支持HTTPS請求。
--with-http_dav_module #開啓WebDAV擴展動作模塊,可爲文件和目錄指定權限
--with-http_flv_module #支持對FLV文件的拖動播放
--with-http_realip_module #支持顯示真實來源IP地址
--with-http_gzip_static_module #預壓縮文件傳前檢查,防止文件被重複壓縮
--with-http_stub_status_module #取得一些nginx的運行狀態
--with-mail #允許POP3/IMAP4/SMTP代理模塊
--with-mail_ssl_module #允許POP3/IMAP/SMTP可以使用SSL/TLS
--with-pcre=../pcre-8.11 #注意是未安裝的pcre路徑
--with-zlib=../zlib-1.2.11 #注意是未安裝的zlib路徑
--with-debug #允許調試日誌
--http-client-body-temp-path #客戶端請求臨時文件路徑
--http-proxy-temp-path #設置http proxy臨時文件路徑
--http-fastcgi-temp-path #設置http fastcgi臨時文件路徑
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi #設置uwsgi 臨時文件路徑
--http-scgi-temp-path=/var/tmp/nginx/scgi #設置scgi 臨時文件路徑

2. 寫個make

3. 寫個make install

4. 裝完就是這樣的

# hahaha @ YSMdeMBP in /usr/local/nginx [11:25:07]
$ ls
conf html logs sbin

 

發佈了141 篇原創文章 · 獲贊 12 · 訪問量 27萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章