linux部署nginx问题总结

错误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

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值