Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1450051
  • 博文数量: 263
  • 博客积分: 10851
  • 博客等级: 上将
  • 技术积分: 2627
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-26 22:40
文章分类

全部博文(263)

文章存档

2013年(4)

2012年(25)

2011年(33)

2010年(50)

2009年(138)

2008年(13)

分类: LINUX

2009-02-10 16:20:45

1. 到下载nginx的源码包, 目前最新的稳定版是nginx-0.6.35
 # wget  
2. 下载依赖包:
 gzip 模块需要 zlib 库
  # wget
 rewrite 模块需要 pcre 库
  # wget
 ssl 功能需要 openssl 库
  # wget
  
3.  解包
 # tar zxvf nginx-0.6.35.tar.gz
 # tar zxvf openssl-0.9.8j.tar.gz
 # tar zxvf pcre-7.8.tar.gz
 # tar zxvf zlib-1.2.3.tar.gz
4.  编译
 # cd nginx-0.6.35/
 # ./configure --prefix=/usr/local/nginx-0.6.35 --without-http_ssi_module  --with-pcre=../pcre-7.8/ --with-zlib=../zlib-1.2.3/ --with-openssl=../openssl-0.9.8j --with-http_stub_status_module --with-http_ssl_module --without-http_memcached_module --without-http_userid_module  --without-http_fastcgi_module --without-http_map_module --without-http_geo_module --without-http_autoindex_module

   --prefix=/usr/local/nginx-0.6.35  # Nginx安装路径。如果没有指定,默认为 /usr/local/nginx。
   --without-http_ssi_module  # 禁用 ngx_http_ssi_module
   --with-pcre=../pcre-7.8/  # 指定 PCRE 库的源代码的路径
   --with-zlib=../zlib-1.2.3/  # 指定 zlib 库的源代码路径
   --with-openssl=../openssl-0.9.8j # 指定 openssl 库的源代码路径
   --with-http_stub_status_module # 启动监控模块(服务状态查看模块)
   --with-http_ssl_module # 把ssl编译进去, 仅仅指定openssl库的源代码路径还是不够哦
   --without-http_memcached_module # 禁用 ngx_http_memcached_module
   --without-http_userid_module  # 禁用 ngx_http_userid_module
   --without-http_fastcgi_module  # 禁用 ngx_http_fastcgi_module
   --without-http_map_module  # 禁用 ngx_http_map_module
   --without-http_geo_module  # 禁用 ngx_http_geo_module
   --without-http_autoindex_module # 禁用 ngx_http_autoindex_module
 
 # make && make install
5.  相关的系统配置
 # ln -ds /usr/local/nginx-0.6.35 /usr/local/nginx
 # mkdir -p /usr/local/nginx/utils
 # mkdir -p /data/nginx_log
 # rm -rf /usr/local/nginx/logs
 # ln -ds /data/nginx_log /usr/local/nginx/logs
 # chown -R xyz:xyz /data/nginx_log /usr/local/nginx-0.6.35
 
 # su xyz -c "/usr/local/nginx/utils/xyz_start.sh"  #使用xyz_start.sh调用/usr/local/nginx/sinb/nginx启动nginx进程
 
6.  启动并测试
 # /usr/local/nginx/sbin/nginx
 在浏览器里输入便可以看到welcome to nginx!的字样
 
 
PS: 2009/09/30 10:00:02 [emerg] 10464#0: unknown directive "ssl" in /usr/local/nginx-0.6.32/conf/nginx.conf:74  这个是因为./configure的时候没有加上
--with-http_ssl_module, 加上重新./configure; make; make install即可
 
 
查看nginx的编译参数:
nginx -V
 
重新加载配置(不需要重启):
nginx -s reload
 
 
阅读(1184) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~