ubuntu12.04安装nginx1.2.2

本文详细介绍了如何下载并编译NGINX源码,解决安装过程中遇到的问题,包括缺失gcc-c++和libtool、openssl库以及启动时错误处理等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、下载最新nginx原码包解压


2、编译

./configure --prefix=/usr/local/nginx \

--with-http_ssl_module \

--with-http_stub_status_module


然后make && make install


可能出错的几处

(1)缺少gcc-c++和libtool,也就是c++编译包 
libtool: compile: unrecognized option `-DHAVE_CONFIG_H' 
libtool: compile: Try `libtool --help' for more information. 
make[1]: *** [pcrecpp.lo] Error 1 
make[1]: Leaving directory `/home/guangbo/work/pcre-8.12' 
make: *** [all] Error 2 

解决方法:直接在线安装apt-get install libtool

(2)缺少openssl库 

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option
解决方法:
sudo apt-get install libssl-dev

(3)启动报错 

nginx启动出错 error while loading shared libraries: libpcre.so.1

解决方法: ln -s /usr/local/lib/libpcre.so.1 /lib


最后测试

/usr/local/nginx/sbin/nginx 然后访问


停止: /usr/local/nginx/sbin/nginx -s stop

测试: /usr/local/nginx/sbin/nginx -t


参考网址

http://www.wangzhibo.com/windows_linux/969.html

http://blog.163.com/dingding_jacky/blog/static/1669127872010101904621142/

http://peterwei.iteye.com/blog/969991

http://wiki.nginx.org/




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值