Ubuntu 10.10下Nginx-0.8.54安装

来源:互联网 发布:卡五星房卡麻将源码 编辑:程序博客网 时间:2024/06/13 09:43

下载nginx-0.8.54.tar.gz,解压并编译安装

相关阅读:Nginx 0.8.54 发布下载修复三个bug

命令说明:

tar(z-用 gzip 对存档压缩或解压;x-从存档展开文件;v-详细显示处理的文件;f-指定存档或设备)

tar –zxvf nginx-0.8.54.tar.gz

进入相关目录

./configure

make

sudo make install

你要运气好的话,一切ok,不过相信没有人运气好的,哈哈。Ubuntu默认的策略是什么库都不装,依赖的库都需要自已手工安装搞定。估计CentOS等linux会好一些。

一般都会出错的,那么我们来看看可能出现的问题。

常见问题解决

缺少pcre library

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

解决方法:下载安装pcre-8.12解决问题,解压后对pcre进行如下操作

./configure

make

sudo make install

运气好一次通过,运气不好,make pcre时会出错

缺少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

www.linuxidc.com@linuxidc-laptop:~/work/pcre-8.12$ libtool -help -DHAVE_CONFIG_H

The program 'libtool' is currently not installed.  You can install it by typing:

sudo apt-get install libtool

www.linuxidc.com@linuxidc-laptop:~/work/pcre-8.12$

解决方法:需要先安装libtool和gcc-c++(ubuntu 下面为g++,直接从iso文件中安装../gcc-defaults/g++_4.4.4_1ubuntu2_i386.deb)

sudo apt-get install libtool

sudo apt-get install gcc-c++

安装 gcc-c++出错

www.linuxidc.com@linuxidc-laptop:~/soft/pcre-8.12$ sudo apt-get install gcc-c++

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Couldn't find package gcc-c

解决办法:更新源,重新安装gcc-c++。

sudo apt-get install build-essential

sudo apt-get update #更新源

sudo apt-get install gcc-c++

upgrade更新的话会花很长时间,如果不报错,可以不进行。

sudo apt-get upgrade #更新已安装的包,更新会很久

缺少openssl库

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

解决办法:

sudo apt-get install openssl

缺少zlib库

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

解决方法:直接下载一个libssl-dev安装,这个包应该也可以解决openssl的问题.

sudo apt-get install libssl-dev

没有nginx,logs目录访问权限

[alert]: could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)

2011/03/21 06:09:33 [emerg] 24855#0: mkdir() "/usr/local/nginx/client_body_temp" failed (13: Permission denied)

解决办法:

sudo chmod a+rwx -R logs

sudo chmod a+rwx -R /usr/local/nginx

测试安装是否成功

对nginx,编译安装没问题后,正式安装并运行

sudo apt-get install nginx

/usr/local/nginx/sbin/nginx

浏览器中打开http://localhost,成功看到欢迎界面。

关闭nginx

./sbin/nginx -s stop

Ubuntu Linux实用命令

tar(z-用 gzip 对存档压缩或解压;x-从存档展开文件;v-详细显示处理的文件;f-指定存档或设备)

tar –zxvf nginx-0.8.54.tar.gz

ip查看

ifconfig

编译

make

安装编译好的源码包

make install

编辑文件

sudo gedit  /etc/profile

修改根限:chmod说明(u:与文件属主拥有一样的权限[a:所有人];+:增加权限;rwx:可读可写可执行)

-R:递归所有目录和文件

sudo chmod a+rwx -R logs

检查是库是否安装成功

dpkg --list|grep openssl

下载安装库

sudo apt-get install libtool

检查服务启动是否正常

ps -ef|grep

查找openssl安装路径

whereis openssl

更新源

sudo apt-get update

更新已安装的包

sudo apt-get upgrade


原创粉丝点击