本文共 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/Makefilemake[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即可编译后目录结构如下。
启动服务
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_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically 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