把安裝nginx-1.4.3.tar.gz的過程完整記錄下來,以免後面每次找得麻煩。
安裝過程中的文件:
nginx-1.4.3.tar.gz
pcre-8.21.tar.gz
openssl-1.0.1c.tar.gz
zlib-1.2.8.tar.gz
包文件會上傳到資源裏面
安裝開始:
1、先配置好yum,完全安裝make,gcc-c++,各個devel
yum -y installgcc automake autoconf libtool make
yum install -y gcc gcc-c++
yum install pcre-devel.x86-64
yum install zlib-devel.x86-64
yum install openssl-devel.x86-64
2、創建好目錄
mkdir /usr/local/pcre
mkdir /usr/local/openssl
mkdir /usr/local/zlib
mkdir /usr/local/nginx
3、上傳文件到指定目錄並解壓,以/opt/nginx爲例
tar -zxvf nginx-1.4.3.tar.gz
4、安裝pcre
cd /opt/nginx/pcre-8.21
./configure --prefix=/usr/local/pcre
make && make install
5、安裝openssl
cd /opt/nginx/openssl-1.0.1c
./config --prefix=/usr/local/openssl
make && make install
6、安裝zlib
cd /opt/nginx/zlib-1.2.8
./configure --prefix=/usr/local/zlib
make && make install
7、安裝nginx
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --without-http_rewrite_module --with-http_flv_module --with-zlib=/opt/nginx/zlib-1.2.8 --with-openssl=/opt/nginx/openssl-1.0.1c
make
make install
到此nginx安裝完成。
此過程中注意項:
要確保安裝好make
另外面在實際安裝過程中,不用帶pcre的選項(如 --with-pcre=/opt/nginx/pcre-8.21)
出現上述的情況時,make會出現如下錯誤:
objs/src/core/nginx.o: In function `main':
/tmp/newLNMP/lanmp/nginx-1.2.6/src/core/nginx.c:275: undefined reference to `ngx_regex_init'