Nginx作為一個后起之秀懂讯,他的迷人之處已經(jīng)讓很多人都投入了他的懷抱装哆。配置簡單,實現(xiàn)原理簡單旗国。做一個負載平衡的再好不過了枯怖。
其原理:
簡單介紹一下他的安裝及配置過程
官方網(wǎng)站
http://wiki.codemongers.com/Main
一、依賴的程序
1. wget http://www.openssl.org/source/openssl-0.9.8l.tar.gz???
2. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.bz2???
3. http://zlib.net/zlib-1.2.7.tar.gz
1. gzip module requires zlib library
2. rewrite module requires pcre library
3. ssl support requires openssl library
4. ngx_cache_purge-1.6
安裝pcre包
tar -xvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make && make install
安裝pcre包
tar -xvf pcre-8.31.tar.gz
cd pcre-8.31
./configure
make && make install
ldd $(which /usr/local/nginx/sbin/nginx)
cd /lib64/
ln -s libpcre.so.0.0.1 libpcre.so.1
添加nginx 用戶
/usr/sbin/groupadd -f nginx
/usr/sbin/useradd -g nginx?nginx
二能曾、安裝
tar -zxvf nginx-1.2.3.tar.gz
tar -zxvf ngx_cache_purge-1.6.tar.gz
cd nginx-1.2.3
./configure --user=daemon --group=daemon --add-module=../ngx_cache_purge-1.6 --prefix=/usr/local/nginx --with-http_stub_status_module
make && make install
默認安裝的路徑是/usr/local/nginx
更多的安裝配置
./configure --prefix=/usr/local/nginx
--with-openssl=/usr/include (啟用ssl)
--with-pcre=/usr/include/pcre/ (啟用正規(guī)表達式)
--with-http_stub_status_module (安裝可以查看nginx狀態(tài)的程序)
--with-http_memcached_module (啟用memcache緩存)
--with-http_rewrite_module (啟用支持url重寫)
-------------------------------------------------------------------------------------------------
./configure --user=daemon --group=daemon --add-module=../ngx_cache_purge-1.6 --prefix=/usr/local/nginx