openSUSE13.1下编译Nginx

本文记录了作者从克隆Nginx代码开始,到解决依赖问题并最终完成编译安装的过程。期间遇到了缺少依赖库如PCRE和zlib的问题,并通过安装相应的开发包解决了这些错误。

首先是拿到代码

@bogon:~/git/nginx> #git clone https://xxxx.nginx.git nginx

clone下来之后我,签出一个本地分支

@bogon:~/git/nginx> git checkout v1.5.13
@bogon:~/git/nginx> git branch local
@bogon:~/git/nginx> git checkout local

然后我看情况的修改了configure,具体怎么改我有哦不太明白,我只是把安装的目标位置换了一下,我不想configure的时候手动输入那么长一串参数。

在我的机器上面configure的时候报错了

./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.

search了一下,说:

@bogon:~/git/nginx> sudo zypper install pcre-devel

能解决这个报错,试了一下,新的问题来了。

./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.

因为我的机器是全新安装的,很多的支持库开发库头文件之类的东西都没有,所以继续search

@bogon:~/git/nginx> sudo zypper install zlib-devel -y

然后后面就几乎没报环境错误了,但是有很多的 not found,比如说:

checking for md5 in system md library ... not found
checking for md5 in system md5 library ... not found
checking for md5 in system OpenSSL crypto library ... not found
checking for sha1 in system md library ... not found
checking for sha1 in system OpenSSL crypto library ... not found

@bogon:~/git/nginx> sudo zypper install openssl-devel -y

解决掉了部分问题,但是没有解决全部 。至于这个对我的运行有没有影响我现在还不太明白,等我真的用得上来了估计就会看明白了把。

不管了,直接编译了

@bogon:~/git/nginx> make

没有报错

@bogon:~/git/nginx> make install

基本上大功告成了。

最后清理一下编译结果,自己的git分支清理干净。

@bogon:~/git/nginx> make clean

然后找到install之后的nginx就可以跑跑试试了,我的因为我修改了configure,所以

@bogon:/usr/nginx/sbin>sudo ./nginx

也可以软链接到 /usr/sbin里面去的。今天就过去了,改睡觉了。

转载于:https://my.oschina.net/MingjunYang/blog/223243

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值