顯示具有 reverse proxy 標籤的文章。 顯示所有文章
顯示具有 reverse proxy 標籤的文章。 顯示所有文章

2012/02/26

Nginx 基本設定教學

下載與安裝:http://wiki.nginx.org/Install
若 make 的時候出現下面錯誤
make -f objs/Makefile
make[1]: Entering directory `/home/user/src/server/nginx-1.0.14'
cd /usr/lib \
        && if [ -f Makefile ]; then make distclean; fi \
        && CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
        ./configure --disable-shared
/bin/sh: line 2: ./configure: No such file or directory
make[1]: *** [/usr/lib/Makefile] Error 127
make[1]: Leaving directory `/home/user/src/server/nginx-1.0.14'
make: *** [build] Error 2
解決方式:
在 configure 時 --with-pcre 指向 pcre 的 source tree
$ ./configure --with-pcre=~/pcre-8.30
$ make 


基本指令

# 啟動
/usr/local/nginx/sbin/nginx

# 停止
/usr/local/nginx/sbin/nginx -s stop

# Reload
/usr/local/nginx/sbin/nginx -s reload

# 編輯設定檔
vim /usr/local/nginx/conf/nginx.conf

# 檢查設定檔
/usr/local/nginx/sbin/nginx -t


下面列出幾種常用的模式: