FeiYan

网站导航

搜索

腾讯微博 新浪微博 FeelBLog 开源中国社区

Ubuntu编译Nginx

2012-08-28 17:58:33     2个评论     9064次访问

之前在一台VPS编译了Nginx环境,1G内存,Ubuntu 12.04 Server版64位。

首先安装基础编译环境:

##g++在CentOS服务器叫做gcc-c++
sudo apt-get install gcc g++ automake make

Wget最新版的Nginx源码,切换到文件夹开始编译,在不添加编译参数的情况下会以此出现下属三个错误:

错误一: 缺少 pcre library
./configure: error: the HTTP rewrite module requires the PCRElibrary.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= option.

错误二: 缺少 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= options.

错误三: 缺少 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= option.

则按照错误依次编译三个缺少的库,其他报错类推:

sudo apt-get install libpcre3-dev libssl-dev openssl

安装 chkconfig :

sudo apt-get install chkconfig ##自启动

最后编译Nginx即可:

## 均采用默认配置,也可以按启用添加自己的扩展
sudo ./configure –prefix=/usr/local/nginx
sudo make && make install
   
## 显示下列则编译成功
Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + md5: using system crypto library
  + sha1: using system crypto library
  + using system zlib library
   
  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

建立软链接并启动Nginx(可选):

##建立软链接
sudo ln -s /usr/local/nginx/sbin/nginx /etc/init.d/
##启动nginx
/etc/init.d/nginx

Job Done!

文章标签: Ubuntu  Nginx 

本文地址:Ubuntu编译Nginx

相关文章

2012-08-20:Linux编译ffmpeg并转换MP3到AMR

2012-09-03:高性能网站架构基础篇

2012-09-17:Ubuntu编译Yaf

2012-09-26:Ubuntu编译安装Redis和PHPRedis

2012-10-22:Ubuntu更新源推荐

2012-10-25:Linux/Ubuntu下CMake编译MySQL

2012-11-06:Win7配置Nginx+PHP+MySQL 坑爹的性能

2012-11-08:Ubuntu配置Nginx+PHP+MySQL开发环境

2012-11-11:Ubuntu/Linux下7款轻量级编辑器

2 Comments »

  1. 飞晏飞晏
    其实我也是在恶补准备换工作,这都是以前总结的内容,哈哈哈~

    @洛奇亚: Linux还是初学的人飘过,虽然用Unix很长时间,但是还是停留在Mac的阶段。要好好恶补一下。

    2012-08-29 07:59:28   

  2. 洛奇亚洛奇亚
    Linux还是初学的人飘过,虽然用Unix很长时间,但是还是停留在Mac的阶段。要好好恶补一下。

    2012-08-29 03:56:04   

发布评论

最新评论

  1. 像蛋哥一样抛弃博客好多年的天涯像蛋哥一样抛弃博客好多年的天涯

    蛋哥,PHP-7.1中mcrypt扩展已被废弃了,还用途广泛个蛋蛋啊,赶紧更新吧。

  2. SpecsSpecs

    不错~~

  3. zhyzhy

    我也遇到这个问题 不知道是swf 、jcrop 、 uploadify 还是浏览器缓存