设为首页 收藏本站
查看: 792|回复: 0

[经验分享] Ubuntu10下Nginx-0.8.54安装的各种错误

[复制链接]

尚未签到

发表于 2016-12-27 07:28:03 | 显示全部楼层 |阅读模式
  转自:http://peterwei.iyunv.com/blog/969991
  
nginx是一个http和反向代理服务器,在高并发环境下性能要比apache好,所以我们也在ubuntu下安装。 


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

命令说明: 

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


Java代码   DSC0000.png


  • tar –zxvf nginx-0.8.54.tar.gz  


进入相关目录 

Java代码  


  • ./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进行如下操作 

Java代码  


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

guangbo@guangbo-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 

guangbo@guangbo-laptop:~/work/pcre-8.12$ 


解决方法:需要先安装libtool和gcc-c++ 

Java代码  


  • sudo apt-get install libtool  
  • sudo apt-get install gcc-c++  



安装 gcc-c++出错
 

guangbo@guangbo-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++。 

Java代码  


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


解决办法: 

Java代码  


  • 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的问题. 

Java代码  


  • 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) 


解决办法: 

Java代码  


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



测试安装是否成功
 

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

Java代码  


  • sudo apt-get install nginx  
  • /usr/local/nginx/sbin/nginx  



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


关闭nginx 

Java代码  


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

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-319847-1-1.html 上篇帖子: Nginx+Php5-fpm在Ubuntu10.04中的安装配置方法 下篇帖子: 通过nginx解决resin集群session不同步问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表