nginx安装的一些问题

安装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 才终于成功了。

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

经验告诉我们,能默认装就装默认的吧,手动安装费时费神啊!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值