將安裝包所有解壓到nginx目錄下
cd nginx-1.13.7
sudo ./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_addition_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_stub_status_module --with-stream --with-pcre=
/home/qinghuan/share/nginx/pcre-8.41 --with-zlib=
/home/qinghuan/share/nginx/zlib-1.2.11 --with-openssl=
/home/qinghuan/share/nginx/openssl-1.1.0g
注:紅色部分爲本身的路徑
sudo make
sudo make install
執行到make時,報錯:WARNING:'aclocal-1.15' is missing on your system.
解決方法:
./configure --docdir=/usr/share/doc/automake-1.15
sudo make
sudo make install
執行命令./configure後,報錯:Autoconf 2.65 or better is required
解決方法:
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
tar xzf autoconf-2.68.tar.gz
cd autoconf-2.68
./configure
sudo make
sudo make install
運行到./configure時,報錯:configure: error: no acceptable m4 could be found in $PATH
解決方法:
wget -O m4-1.4.9.tar.gz http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
tar -zvxf m4-1.4.9.tar.gz
cd m4-1.4.9
./configure
sudo make
sudo make install
此時沒有報錯了,再依次倒序安裝上面的安裝包。
安裝完畢後,在/usr/local下有nginx目錄,進入nginx目錄
執行:sudo ./sbin/nginx -c ./conf/nginx.conf
在本地物理機的瀏覽器中輸入ip地址,有以下顯示: