centos系統(tǒng)
cd ~
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
wget http://zlib.net/fossils/zlib-1.2.8.tar.gz
wget https://github.com/lihhhh/download/raw/master/nginx/pcre-8.38.tar.gz
yum install gcc-c++
cd ~
tar zxvf openssl-fips-2.0.9.tar.gz
cd openssl-fips-2.0.9
./config && make && make install
cd ~
tar zxvf pcre-8.38.tar.gz
cd pcre-8.38
./configure && make && make install
cd ~
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure && make && make install
cd ~
tar zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
yum -y install openssl openssl-devel
./configure --with-http_ssl_module && make && make install
ubuntu 系統(tǒng)
cd ~
wget http://nginx.org/download/nginx-1.25.0.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
sudo apt-get install build-essential
cd ~
tar zxvf openssl-fips-2.0.9.tar.gz
cd openssl-fips-2.0.9
./config && make && sudo make install
cd ~
tar zxvf pcre-8.44.tar.gz
cd pcre-8.44
./configure && make && sudo make install
cd ~
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure && make && sudo make install
cd ~
tar zxvf nginx-1.25.0.tar.gz
cd nginx-1.25.0
sudo apt-get install libssl-dev
./configure --with-http_ssl_module && make && sudo make install
啟動nginx
/usr/local/nginx/sbin/nginx
出現(xiàn)錯誤提示
[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 找不到文件路徑?。?br>
[root@localhost] ln -s /usr/local/lib/libpcre.so.1 /lib64/
然后再啟動/usr/local/nginx/sbin/nginx應該就ok了
測試訪問服務器ip 不用加端口號:

image.png