Nginx安装解决报错
安装包:
nginx-1.13.7.tar.gz
openssl-1.1.0g.tar.gz
pcre-8.41.tar.gz
zlib-1.2.11.tar.gz
新建文件夹:nginx
注:我没有新建nginx的时候,运行make命令的时候,报了如下error。新建nginx后没有报错
![](https://img2020.cnblogs.com/blog/1499308/202007/1499308-20200706213130173-337003512.png)
将安装包全部解压到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.
![](https://img2020.cnblogs.com/blog/1499308/202007/1499308-20200706213409387-1848141617.png)
解决方法:
./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
![](https://img2020.cnblogs.com/blog/1499308/202007/1499308-20200706215052880-1411725122.png)
解决方法:
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地址,有如下显示:
![](https://img2020.cnblogs.com/blog/1499308/202007/1499308-20200706222028267-732634985.png)