博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Nginx1.14.0 编译安装
阅读量:6956 次
发布时间:2019-06-27

本文共 2029 字,大约阅读时间需要 6 分钟。

参考资料

1、

安装编译工具及库文件

yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre pcre-devel

./configure --group=nginx --user=nginx --prefix=/usr/local/app/nginx_v/nginx-1.14.0 --with-http_stub_status_module --with-http_ssl_module

看编译看,还要编译zlib,pcre的,不知道为什么原因,

编译pcre

编译zlib

这里指定的with-pcre 和with-zlib的路径不能他们编译指定的--prefix路径,而是其解压的用来编译的路径。

./configure --group=nginx --user=nginx --prefix=/usr/local/app/nginx_v/nginx-1.14.0 --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre=/usr/local/app/nginx_v/pcre-8.42 --with-zlib=/usr/local/app/nginx_v/zlib-1.2.11

[root@ewifi-A nginx-1.14.2]# make && make install

make -f objs/Makefile
make[1]: Entering directory /usr/localapp/packages/nginx-1.14.2'<br/>cd /usr/local/app/nginx_v/pcre-8.42 \<br/>&& if [ -f Makefile ]; then make distclean; fi \<br/>&& CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \<br/>./configure --disable-shared <br/>/bin/sh: line 2: ./configure: 没有那个文件或目录<br/>make[1]: *** [/usr/local/app/nginx_v/pcre-8.42/Makefile] 错误 127<br/>make[1]: Leaving directory/usr/local/app/packages/nginx-1.14.2'
make: *** [build] 错误 2

./configure --group=nginx --user=nginx --prefix=/usr/local/app/nginx_v/nginx-1.14.0 --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11

这里我写的配置参数错了,就重新跑下./configure,会去重新生成makefile文件。

然后删除之前安装的目录,再次执行make &&make install即可

编译后目录结构如下。

Nginx1.14.0 编译安装

启动服务

cd /usr/local/ewifi/nginx_v/nginx-1.14.0/sbin/

./nginx

这里注意的是默认监听端口80,要查看此接口是否被占用,而且最好不要用默认端口。修改端口后再启动。

常见问题:

1、默认,不指定pcre路径时。

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

需要安装pcre-devel所以说,安装前准备工作要做好。

2、nginx: [emerg] getpwnam("nginx") failed

说明编译时指定的用户没有创建,创建即可

转载于:https://blog.51cto.com/lajifeiwomoshu/2153598

你可能感兴趣的文章
(转载)Windows 7 Ultimate(旗舰版)SP1 32/64位官方原版下载(2011年5月12日更新版)...
查看>>
内置函数
查看>>
mysql之触发器
查看>>
C 入门 第七节 结构体
查看>>
linux下安装svn
查看>>
Flash Builder快捷键
查看>>
js通过Image和canvas获取图片的base64格式的字符串(只能接受服务器上的图片,不支持本地图片直接转化为base64,因为js没有系统io的权限,js只能操作dom)...
查看>>
转:Unity3D研究院之提取游戏资源的三个工具支持Unity5(八十四)
查看>>
Javascript学习之Window
查看>>
mac 文本编辑器 文本编码Unicode utf-8 不适用的问题
查看>>
如何做好H5性能优化?
查看>>
通过WebClient模拟post上传文件到服务器
查看>>
js判断是否是PC,IOS,Android客户端
查看>>
HTTP
查看>>
sound of the genuine
查看>>
iOS开发之WIFI,3G/4G两种网络同时使用技巧
查看>>
Nodejs基础(5-6)HTTP概念进阶
查看>>
(十)struts2的异常处理机制
查看>>
体验VIP版本灰鸽子,哈哈,拿到了老师的病毒教程
查看>>
倒计时
查看>>