您的位置:首页 > 运维架构 > Nginx

nginx安装的一些问题

2016-06-14 17:53 429 查看
安装nginx本觉得很容易的事,结果把我整惨了,一开始按照提示的错误,q去下载了各种依赖包,包括zlib-1.2.4 ,openssl-0.9.8,pcre等,并手动编译,安装。。。

进入Ningx目录configure时,本以为这条命令能大功告成,

./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/openssl-0.9.8 --with-md5=/usr/local/openssl-0.9.8 --with-zlib=/usr/local/zlib-1.2.4 --user=www --group=www

结果出现的各种错误,调了我一晚上,错误顺序记不清了,大概有如下些错误:

“./configure: error: the HTTP cache module requires md5 functions

from OpenSSL library.   You can either disable the module by using

--without-http-cache option, or install the OpenSSL library into the system,

or build the OpenSSL library statically from the source with nginx by using

--with-http_ssl_module --with-openssl=<path> options.”

解决办法:按照说明的加上--with-http_ssl_module   --with-openssl=<path>。

make时出现的错误:

“make -f objs/Makefile

make[1]: Entering directory `/home/nginx-0.7.65'

cd /usr/local/pcre \

       && if [ -f Makefile ]; then make distclean; fi \

       && CC="gcc" CFLAGS="" \

       ./configure --disable-shared

/bin/sh: line 2: ./configure: 没有那个文件或目录

make[1]: *** [/usr/local/pcre/Makefile] 错误 127

make[1]: Leaving directory `/home/nginx-0.7.65'

make: *** [build] 错误 2”

解决办法,把手动安装的pcre卸了,make uninstall就行,然后让机器安装yum install pcre-devel版,

去掉--with-pcre=/....

“make[1]: Entering directory `/home/nginx-0.7.65'

cd /usr/local/openssl-0.9.8 \

&& make clean \

&& ./config --prefix=/usr/local/openssl-0.9.8/.openssl no-shared no-threads \

&& make \

&& make install

make[2]: Entering directory `/usr/local/openssl-0.9.8'

make[2]: *** 没有规则可以创建目标“clean”。 停止。

make[2]: Leaving directory `/usr/local/openssl-0.9.8'

make[1]: *** [/usr/local/openssl-0.9.8/.openssl/include/openssl/ssl.h] 错误 2

make[1]: Leaving directory `/home/nginx-0.7.65'

make: *** [build] 错误 2”

这个问题由于--with-http_ssl_module依赖MD5而取不到引起,若去掉--with-http_ssl_module后不行,同样用yum install openssl-devel,然后再去掉--with-http_ssl_module

“ && make libz.a

make[2]: Entering directory `/usr/local/zlib-1.2.4'

make[2]: *** 没有规则可以创建目标“clean”。 停止。

make[2]: Leaving directory `/usr/local/zlib-1.2.4'

make[1]: *** [/usr/local/zlib-1.2.4/libz.a] 错误 2

make[1]: Leaving directory `/home/nginx-0.7.65'

make: *** [build] 错误 2”

由于上面机器自动安装时安装了zlib, 所以再去掉--with-zlib=/usr/local/zlib-1.2.4。

最后,./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-openssl=/usr/local/openssl-0.9.8   --user=www --group=www 才终于成功了。

把问题贴出来,好让有同样遭遇的初学者参考。

经验告诉我们,能默认装就装默认的吧,手动安装费时费神啊!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx