Linux 安裝nginx

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

啟動(dòng)nginx
/usr/local/nginx/sbin/nginx

出現(xiàn)錯(cuò)誤提示
[root@localhost lib]# error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

原因 在RedHat 64位機(jī)器上nginx讀取的pcre文件為/lib64/libpcre.so.1文件,默認(rèn)安裝pcre時(shí)libpcre.so文件安裝在/usr/local/lib/目錄下,所以輸入/opt/nginx/sbin/nginx -V 找不到文件路徑??!
[root@localhost] ln -s /usr/local/lib/libpcre.so.1 /lib64/
然后再啟動(dòng)/usr/local/nginx/sbin/nginx應(yīng)該就ok了

測(cè)試訪問(wèn)服務(wù)器ip 不用加端口號(hào):


image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容