linux nginx編譯安裝

ubantu16.4????????? nginx1.5.11

sudo apt-get install libpcre3-dev

sudo apt-get install openssl libssl-dev libperl-dev

sudo apt-get install libgd2-xpm

sudo apt-get install libgd2-xpm-dev

sudo apt-get install libgoogle-perftools-dev

sudo apt-get install? libpcre3-dev

sudo apt-get install libperl-de

安裝nginx

wget http://nginx.org/download/nginx-1.5.11.tar.gz

./configure \

--prefix=/usr/local/nginx \

--with-file-aio \ #提高IO讀寫(xiě)能力,提高性能

--with-http_realip_module \ #可以透過(guò)7層反向代理得到真實(shí)IP

--with-http_addition_module \ #在頁(yè)面上附加其他文本

--with-http_image_filter_module \ #調(diào)用GD庫(kù)對(duì)圖片文件進(jìn)行處理

--with-http_sub_module \ # 提供替換頁(yè)面中文字的功能

--with-http_gzip_static_module \ #對(duì)靜態(tài)文件進(jìn)行預(yù)GZIP壓縮

--with-http_stub_status_module \ #查看服務(wù)器的統(tǒng)計(jì)信息

--with-http_perl_module \# 允許在Nginx配置文件中執(zhí)行Perl語(yǔ)句

--http-log-path=\var\log\nginx\access.log \#指定訪問(wèn)日志的路徑

--with-google_perftools_module \#開(kāi)啟Google Performence Tool

sudo ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_ssl_module

sudo make & make install

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 啟動(dòng)

/usr/local/nginx/sbin/nginx -s? reload 重新加載nginx

/usr/local/nginx/sbin/nginx -V 查看安裝過(guò)哪些模塊

/usr/local/nginx/sbin/nginx -h 查看ngix版本

/usr/local/nginx/sbin/nginx -t 查看ngix配置文件是否正確

nginx 做反向代理,真實(shí)服務(wù)器獲取不到真實(shí)host和真實(shí)ip的解決辦法

http {

? ? ? #讓反向代理服務(wù)器設(shè)置請(qǐng)求頭交給真實(shí)的web服務(wù)器

? ? ? proxy_set_header Host $host;

? ? ? #讓反向代理服務(wù)器設(shè)置真實(shí)的ip交給真實(shí)的web服務(wù)器

? ? ? proxy_set_header X-Real-IP $remote_addr;

? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

? }

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容