1、
http:
下載對應版本:wget
http:
tar -zxvf nginx-
1.5.9.tar.gz
.
/configure --prefix=/usr/local/nginx
make && make install
若是安裝過程遇到問題:
錯誤爲:./
configure: error: the HTTP rewrite module requires the PCRE library.
yum -y install prce-devel
錯誤爲:
Loaded
plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
No
package prce-devel available.
Error: Nothing to do
錯誤爲:./
configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
yum -y install openssl openssl-devel
再安裝nginx
2、啓動 中止等操做
/usr/nginx/sbin/nginx (/usr/nginx/sbin/nginx -t 查看配置信息是否正確)
從容中止Nginx:
kill -quit 主進程號
快速中止Nginx:
kill -term 主進程號
強制中止Nginx:
pkill -
9 nginx
進入:
/usr/java/nginx位置
下載
nginx: wget http:
下載
openssl : wget http:
下載
zlib : wget http:
下載
pcre : wget ftp:
若是沒有安裝c++編譯環境,還得安裝,經過yum install gcc-c++完成安裝
下一步,編譯安裝
openssl :
[root
@localhost] tar zxvf openssl-fips-2.0.9.tar.gz
[root
@localhost] cd openssl-fips-2.0.9
[root
@localhost] ./config && make && make install
pcre:
[root
@localhost] tar zxvf pcre-8.36.tar.gz
[root
@localhost] cd pcre-8.36
[root
@localhost] ./configure && make && make install
zlib:
[root
@localhost]tar zxvf zlib-1.2.8.tar.gz
[root
@localhost] cd zlib-1.2.8
[root
@localhost] ./configure && make && make install
最後安裝nginx
[root
@localhost] mkdir nginx
//copy nginx.conf
[root
@localhost]tar zxvf nginx-1.8.0.tar.gz
[root
@localhost] cd nginx-1.8.0
[root
@localhost] ./configure && make && make install
啓動nginx
/usr/local/nginx/sbin/nginx
出現錯誤提示
[root
@localhost lib]# error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
緣由 在RedHat
64位機器上nginx讀取的pcre文件爲/lib64/libpcre.so.1文件,默認安裝pcre時libpcre.so文件安裝在/usr/local/lib/目錄下,因此輸入/opt/nginx/sbin/nginx -V 找不到文件路徑!!
1.首先肯定安裝了pcre.
2.切換路徑: cd /usr/local/lib 執行 ln -s /usr/local/lib/libpcre.so.1 /lib64/
3.root權限下添加軟連接 /usr/local/lib/libpcre.so.1 到 /lib64/ : ln -s /usr/local/lib/libpcre.so.1 /lib64/