nginx0.7.65源码编译安装on centos V1.1

四月 19th, 2010 Posted in Nginx | 阅读次数: 237 次

制作:高进波
时间:2010-04-03
主题:nginx源码编译安装on centos

1.环境
centos5.4   

nginx0.7.65

 

2.下载源码
http://nginx.org/en/download.html

 

3.安装依赖组件
yum install gcc gcc=c++ autoconf automake openssl-devel pcre-devel zlib-devel

yum install php-cli php-gd php-mbstring php-mhash php-pear php-xml php-imap php-mcrypt php-mysql

 

4.配置编译选项
./configure –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_gzip_static_module

 

5.编译安装
make && make install

 

6.安装php支持fastcgi
下载地址:
http://redmine.lighttpd.net/projects/spawn-fcgi/news
http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz

添加到rc.local
/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 50 -u www -f /usr/bin/php-cgi

 

3.修改配置文件
vi /usr/local/nginx/conf/nginx.conf
user  www www;

worker_processes 8;

error_log  logs/error.log  crit;

#pid        logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;

events
{
  use epoll;
  worker_connections 65535;
}

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

  #charset  utf-8;
  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 300m;
  sendfile on;
  tcp_nopush     on;

  keepalive_timeout 60;

  tcp_nodelay on;

  client_body_buffer_size  512k;
  proxy_connect_timeout    5;
  proxy_read_timeout       60;
  proxy_send_timeout       5;
  proxy_buffer_size        16k;
  proxy_buffers            4 64k;
  proxy_busy_buffers_size 128k;
  proxy_temp_file_write_size 128k;

  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 16k;
  gzip_http_version 1.1;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;

  #限制并发和速率
  limit_zone   one  $remote_addr  10m;

  include upstream.conf;
  server {
  include port.conf;
  server_name null;

  location /
  {
  root /dev/null;
  log_not_found off;
  }

}

  include host/*.conf;

}

新建主机配置
vi host/gaojinbo.com.conf
server {
        #listen       192.168.143.87:80;
        include /usr/local/nginx/conf/port.conf;
        server_name  www.gaojinbo.com gaojinbo.com *.gaojinbo.com;

        #charset utf8;

        #access_log  logs/host.access.log  main;

        #限制并发和速率
        limit_conn one   10;
        limit_rate 20k;
        location / {
            root   /var/www/nginx/www.gaojinbo.com;
            index  index.php index.html index.htm;
            include /usr/local/nginx/conf/wp_rewrite.conf;

        }

        error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/nginx/www.gaojinbo.com$fastcgi_script_name;
            include        fastcgi_params;
        }
        # deny access to .htaccess files, if Apache’s document root
        # concurs with nginx’s one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}

location /hugwww_nginx {
        stub_status on;
}

    }

 

完成!

相关日志:

Tags:

4 Responses to “nginx0.7.65源码编译安装on centos V1.1”

  1. 淘客吧 Says:

    不会赚钱就要省钱,不会省钱就上淘客吧


  2. Treatment for Panic Attacks Says:

    Favourite Sites…

    [...]I like to honor other websites on the web, even if they are not related to my site, by linking to them. Below are some websites I think are worth checking out http://www.panicattackstreatmentcure.net/links/…...


  3. {vehicle storage facility|retail store|a real estate directory|rent houses|apartment renter|rent houses|renting|apartment renter|school resources|new books} Says:

    Read was interesting, stay in touch……

    [...]please visit the sites we follow, including this one, as it represents our picks from the web[...]……


  4. tips Says:

    tips…

    [...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » nginx0.7.65源码编译安装on centos V1.1[...]…


留下您的脚印