因為nginx的安裝需要依賴其他函式庫,所以要先安裝依賴函式庫。以下是具體步奏
http://nginx.org/download/nginx-1.2.8.tar.gz
1.安裝PCRE庫
cd /usr/local/
wget ftp://ftp.csx.cam .ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
tar -zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make
make install
make install
make install
make install
make install
make install
make install
make install
make install
make install 64位元機器要加入軟連線nginx才能讀取得到
ln -s /usr/local/lib/libpcre.so.1 /lib64/
2.安裝zlib函式庫
cd /usr/local/
wget http:/ /zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install
3.方法一:
yum -y install openssl openssl-devel
方法二:
cd /usr/local/
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
-zxvf openssl-1.0.1c.tar.gz
./config
make
make install
4.安裝nginx
cd /usr/local/
wget http://nginx.org/download/nginx-1.6.2. gz
tar -zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure --prefix=/usr/local/nginx-1.6.2 --with-http_ssl_module --with-http_module - staticule_pule - -with-openssl=/usr/local/ssl
make
make install
//建立一個軟連接
ln -s /usr/local/nginx-1.6.2 nginx
注意:
--with-http_ssl_module 是為了配置https存取所需的模組
--with-http_gzip_static_module 是靜態壓縮模組
啟動nginx::
/usr/local/nginx/sbin/nginx
檢查設定檔:
sbin/nginx -t
指定設定檔啟動:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
重開機
/ /nginx/sbin/nginx -s reload
以上就介紹了linux下nginx安裝,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。