错误1、make[1]: *** [Makefile:1113: pcrecpp.lo] Error 1
原因:缺少gcc安装包
解决方案:执行yum -y install gcc-c++安装编译器
错误2、make[1]: *** [objs/Makefile:445: objs/src/core/ngx_murmurhash.o] Error
原因:-Werrori意思要求GCC将所有的警告当成错误进行处理,所有导致错误输出并不能进行下一步
解决方案:进入/nginx1.10.1/objs/ 将Makefile文件第三行的-Werror去掉
错误3、make[1]: *** [objs/Makefile:827: objs/src/os/unix/ngx_user.o] Error
原因:未知
解决方案:进入/nginx-1.10.1/src/os/unix,注释文件ngx_user.c文件36行代码/* cd.current_salt[0] = ~salt[0]; */
参考:https://www.jb51.net/article/190524.htm
附:安装教程
1、下载nginx-1.10.1.tar.gz资源包(下载),并上传服务器;
2、执行命令:
tar -zvxf nginx-1.10.1.tar.gz
cd nginx-1.10.1
tar -zvxf nginx-1.10.1.tar.gz
tar -zvxf nginx-sticky-module.tar.gz
tar -zvxf nginx_upstream_check_module.tar.gz
tar -zvxf openssl-1.0.1c.tar.gz
tar -zvxf pcre-8.31.tar.gz
tar -zvxf zlib-1.2.8.tar.gz
3、进入/nginx-1.10.1/nginx-1.10.1目录,执行以下命令:
./configure \
--prefix=/app/middleware/nginx \
--with-stream \
--with-http_gzip_static_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_realip_module \
--with-pcre=../pcre-8.31 \
--with-http_realip_module \
--add-module=../nginx-sticky-module \
--add-module=../nginx_upstream_check_module \
--with-openssl=../openssl-1.0.1c \
--with-zlib=../zlib-1.2.8
可能的错误:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
出现上述错误,需要安装“zlib-devel”即可。SSH执行以下命令:
yum install -y zlib-devel
然后再执行configure即可
4、执行命令
make && make install
上述命令会在/app/middleware/(即是第三步设置的--prefix的路径)创建nginx 目录。
5、相关启停命令
启动:./nginx
关闭:./nginx -s stop
刷新:./nginx –s reload