Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1193414
  • 博文数量: 116
  • 博客积分: 2889
  • 博客等级: 少校
  • 技术积分: 1337
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-29 09:35
个人简介

IT运维工程师、律师 IT相关技术支持、法律咨询

文章分类

全部博文(116)

文章存档

2015年(1)

2014年(2)

2013年(5)

2012年(12)

2011年(4)

2010年(12)

2009年(21)

2008年(37)

2007年(22)

分类: LINUX

2009-07-02 09:36:28

1.安装:
[root@localhost]#./configure --prefix=/usr/local/server/nginx --with-openssl=/usr/include \
--with-pcre=/usr/include/pcre/ --with-http_stub_status_module --without-http_memcached_module \
--without-http_fastcgi_module --without-http_rewrite_module --without-http_map_module \
--without-http_geo_module --without-http_autoindex_module

由于Nginx的配置文件中我想用到正则,所以需要 pcre 模块的支持。我已经安装了 pcrepcre-devel 的rpm包,但是 Ngxin 并不能正确找到 .h/.so/.a/.la 文件,因此我稍微变通了一下:
[root@localhost]#mkdir /usr/include/pcre/.libs/
[root@localhost]#cp /usr/lib/libpcre.a /usr/include/pcre/.libs/libpcre.a
[root@localhost]#cp /usr/lib/libpcre.a /usr/include/pcre/.libs/libpcre.la

可能还会报错,报错信息中有“--disable-shared"的字样,

然后,修改 objs/Makefile 大概在926行的位置上,注释掉以下内容:

./configure --disable-shared
2。修改配置文件:


[root@wxserver2 conf]# vi nginx.conf



             

user nobody;
worker_processes 1;

#error_log logs/error.log;

error_log logs/error.log notice;
#error_log logs/error.log info;


pid ld logs/nginx.pid;

pid logs/nginx.pid;


events {
    worker_connections 1024;
}


http {
    include mime.types;
    default_type application/octet-stream;

    #log_format main '$remote_addr - $remote_user [$time_local] "$request" '

    # '$status $body_bytes_sent "$http_referer" '

    # '"$http_user_agent" "$http_x_forwarded_for"';


    #access_log logs/access.log main;


    sendfile on;
    #tcp_nopush on;


    #keepalive_timeout 0;

    keepalive_timeout 65;
   
#gzip on;

    upstream www.one234.net {
              server 10.11.22.164:80;
      }



    server {
        listen 800;
        server_name 10.11.22.164 www.one234.net;

        charset gb2312;

# access_log logs/ main;

              location / {
                       proxy_pass http://www.one234.net;
                       proxy_set_header Host $host;
                       proxy_set_header X-Real-IP $remote_addr;
                       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


3。测试配置文件

测试当请目录下nginx.conf文件是否正确,使用命令:

nginx -t -c nginx.conf

2009/04/27 22:17:57 [info] 54240#0: the configuration file nginx.conf syntax is ok
2009/04/27 22:17:57 [info] 54240#0: the configuration file nginx.conf was tested successfully



阅读(3850) | 评论(0) | 转发(0) |
0

上一篇:油又涨价了

下一篇:加速yum的下载

给主人留下些什么吧!~~