Chinaunix首页 | 论坛 | 博客
  • 博客访问: 17884
  • 博文数量: 14
  • 博客积分: 2500
  • 博客等级: 少校
  • 技术积分: 150
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-11 15:02
文章分类

全部博文(14)

文章存档

2011年(1)

2010年(12)

2009年(1)

我的朋友
最近访客

分类: 系统运维

2010-06-24 10:15:50

 

nginx.conf

 

# 使用的用户和组

#user www www;

 

# 指定工作衍生进程数

worker_processes  10;

 

#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;

 

#pid        logs/nginx.pid;

 

 

events {

# 使用的网络I/O模型,Linux系统推荐采用epoll模型,FreeBSD系统推荐采用kqueue模型

    use epoll;

# 允许的连接数

    worker_connections  51200;

}

 

 

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;

 

# 设置使用的字符集

 #   charset gb2312,utf-8;

# 开启高效文件传输模式

    sendfile        on;

# 以下两个选项用于防止网络阻塞

    tcp_nopush          on;

    tcp_nodelay on;

 

# 长链接超时时间

    keepalive_timeout  300;

 

# fastcgi连接超时时间,下面的看字面意思都能理解个大概了,就不解释了.

    fastcgi_connect_timeout 300;

    fastcgi_send_timeout 300;

    fastcgi_read_timeout 300;

    fastcgi_buffer_size 128k;

    fastcgi_buffers 4 256k;

    fastcgi_busy_buffers_size 256k;

    fastcgi_temp_file_write_size 256k;

    fastcgi_temp_path /dev/shm;

 

# 打开gzip压缩

    gzip on;

# 最小压缩文件大小

    gzip_min_length  1k;

# 压缩缓冲区

    gzip_buffers     4 8k;

# 压缩版本(默认1.1,前端为squid2.5使用1.0

    gzip_http_version 1.1;

# 压缩类型,默认就已经包含text/html 所以下面就不用再写了,当然写上去的话,也不会有问题,但是会有一个warn

    #gzip_types       text/plain application/x-javascript text/css text/html text/javascript application/xml;

 

# 错误页面

    #error_page 404 ;

    #error_page 403 ;

# 上传文件大小限制

    #client_max_body_size 20m;

# 设定请求缓

    #client_header_buffer_size 16k;

    #large_client_header_buffers 4 64k;

# 设定负载均衡的服务器列表

# 如果在同一台机器上,单独起4组独立的php-cgi进程(每组8个子进程),性能应该不如1php-cgi进程(32个子进程),因为1组进程,eacceleratorPHP二进制文件缓存是共享的,1组进程命中率较高。

# 不过好处是,碰到某组的php假死的话,其他端口就可以接管了,我实测下来似乎发生502错误的概率降低了很多,或者说我这样配置以后还没有遇到

   #upstream mysvr {

# weigth参数表示权值,权值越高被分配到的几率越大

# 本机上的Squid开启3128端口

   #server 192.168.8.1:3128 weight=5;

   #server 192.168.8.2:80   weight=1;

   #server 192.168.8.3:80   weight=6;

#}

 

# 基于域名的虚拟主机

# 1个虚拟主机

    server {

# 监听端口

        listen       80;

# 主机名称

        server_name  ;

        location / {

        # WEB文件存放目录

            root   /wwwroot/domains/goldhr.com.cn/public_html;

        # 默认首页文件

            index index.html index.htm index.php;

        location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  /wwwroot/domains/goldhr.com.cn/public_html$fastcgi_script_name;

            include        fastcgi_params;

        }

        }

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }

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

上一篇:Apache两种模块

下一篇:Apache日志分析

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