Chinaunix首页 | 论坛 | 博客
  • 博客访问: 542615
  • 博文数量: 48
  • 博客积分: 1249
  • 博客等级: 中尉
  • 技术积分: 1926
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-04 10:22
文章存档

2012年(3)

2011年(45)

分类: 系统运维

2011-12-15 12:05:58

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。

我的生产环境下的nginx.conf配置文件,做了虚拟主机设置的,大家可以根据需求更改,下载即可在自己的机器上使用了,本配置文件摘录自《构建高可用Linux服务器》(机械工业出版社),转载麻烦注明出处,谢谢,配置文件如下:

  1. user  www www; 
  2. worker_processes 8; 
  3. error_log  /data/logs/nginx_error.log  crit; 
  4. pid        /usr/local/webserver/nginx/nginx.pid; 
  5. #Specifies the value for maximum file descriptors that can be opened by this process.  
  6. worker_rlimit_nofile 65535; 
  7. events  
  8.   use epoll; 
  9.   worker_connections 65535; 
  10. http  
  11.   include       mime.types; 
  12.   default_type  application/octet-stream; 
  13.   #charset  gb2312; 
  14.   server_names_hash_bucket_size 128; 
  15.   client_header_buffer_size 32k; 
  16.   large_client_header_buffers 4 32k; 
  17.   client_max_body_size 8m; 
  18.        
  19.   sendfile on; 
  20.   tcp_nopush     on; 
  21.   keepalive_timeout 60; 
  22.   tcp_nodelay on; 
  23.   fastcgi_connect_timeout 300; 
  24.   fastcgi_send_timeout 300; 
  25.   fastcgi_read_timeout 300; 
  26.   fastcgi_buffer_size 64k; 
  27.   fastcgi_buffers 4 64k; 
  28.   fastcgi_busy_buffers_size 128k; 
  29.   fastcgi_temp_file_write_size 128k; 
  30.   gzip on; 
  31.   gzip_min_length  1k; 
  32.   gzip_buffers     4 16k; 
  33.   gzip_http_version 1.0; 
  34.   gzip_comp_level 2; 
  35.   gzip_types       text/plain application/x-javascript text/css application/xml; 
  36.   gzip_vary on; 
  37.   #limit_zone  crawler  $binary_remote_addr  10m; 
  38.   server  
  39.   { 
  40.     listen 80 default; 
  41.     server_name _; 
  42.     index index.html index.htm index.php; 
  43.     root /data/htdocs/www; 
  44.     #server_name_in_redirect off; 
  45.      
  46.     location ~ .*\.(php|php5)?$ 
  47.     { 
  48.       #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  49.       fastcgi_pass  127.0.0.1:9000; 
  50.       fastcgi_index index.php; 
  51.       include fcgi.conf; 
  52.     } 
  53.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  54.     { 
  55.       expires      30d; 
  56.     } 
  57.     location ~ .*\.(js|css)?$ 
  58.     { 
  59.       expires      1h; 
  60.     } 
  61.     } 
  62.   server 
  63.   { 
  64.     listen       80; 
  65.     server_name  
  66.     index index.html index.htm index.php; 
  67.     root  /data/htdocs/www/adongweb; 
  68.     #limit_conn   crawler  20;     
  69.     location ~ .*\.(php|php5)?$ 
  70.     {       
  71.       #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  72.       fastcgi_pass  127.0.0.1:9000; 
  73.       fastcgi_index index.php; 
  74.       include fcgi.conf; 
  75.     } 
  76.      
  77.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  78.     { 
  79.       expires      30d; 
  80.     } 
  81.     location ~ .*\.(js|css)?$ 
  82.     { 
  83.       expires      1h; 
  84.     }     
  85.     log_format  access  '$remote_addr - $remote_user [$time_local] "$request" ' 
  86.               '$status $body_bytes_sent "$http_referer" ' 
  87.               '"$http_user_agent" $http_x_forwarded_for'; 
  88.     access_log  /data/logs/access.log  access; 
  89.       } 
  90.   server 
  91.   { 
  92.     listen       80; 
  93.     server_name  
  94.     index index.html index.htm index.php; 
  95.     root  /data/htdocs/www/ImageVue; 
  96.     #limit_conn   crawler  20; 
  97.    
  98.     location ~ .*\.(php|php5)?$ 
  99.     { 
  100.       #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  101.       fastcgi_pass  127.0.0.1:9000; 
  102.       fastcgi_index index.php; 
  103.       include fcgi.conf; 
  104.     } 
  105.    
  106.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  107.     { 
  108.       expires      30d; 
  109.     } 
  110.     location ~ .*\.(js|css)?$ 
  111.     { 
  112.       expires      1h; 
  113.     } 
  114.     access_log  off; 
  115.       } 
  116.   server 
  117.   { 
  118.     listen       80; 
  119.     server_name  
  120.     index index.html index.htm index.php; 
  121.     root  /data/htdocs/www/xhui/hybike; 
  122.     location ~ .*\.(php|php5)?$ 
  123.     {       
  124.       #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  125.       fastcgi_pass  127.0.0.1:9000; 
  126.       fastcgi_index index.php; 
  127.       include fcgi.conf; 
  128.     } 
  129.      
  130.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  131.     { 
  132.       expires      30d; 
  133.     } 
  134.     location ~ .*\.(js|css)?$ 
  135.     { 
  136.       expires      1h; 
  137.     } 
  138.     access_log  off; 
  139.   } 
  140. server 
  141.   { 
  142.     listen       80; 
  143.     server_name  
  144.     index index.html index.htm index.php; 
  145.     root  /data/htdocs/www/very365;    
  146.   location / 
  147.   {      
  148.   rewrite ^/(.*)/product/([0-9]+)/$ /seoproduct\.php\?spell=$1&productid=$2; 
  149.   rewrite ^/brand/(.*)/page/([0-9]+)/$ /seobrand\.php\?spell=$1&page=$2; 
  150.   rewrite ^/brand/(.*)/$ /seobrand\.php\?spell=$1; 
  151.     } 
  152.     location ~ .*\.(php|php5)?$ 
  153.     { 
  154.       #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  155.       fastcgi_pass  127.0.0.1:9000; 
  156.       fastcgi_index index.php; 
  157.       include fcgi.conf; 
  158.       fastcgi_param SCRIPT_FILENAME /data/htdocs/www/very365$fastcgi_script_name; 
  159.       fastcgi_param  SCRIPT_NAME  /data/htdocs/www/very365$fastcgi_script_name; 
  160.     } 
  161.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  162.     { 
  163.       expires      30d; 
  164.     } 
  165.     location ~ .*\.(js|css)?$ 
  166.     { 
  167.       expires      1h; 
  168.     } 
  169.     access_log  off; 
  170.   } 
  171. server 
  172.   { 
  173.     listen       80; 
  174.     server_name  
  175.     index index.html index.htm index.php; 
  176.     root  /data/htdocs/www/wqueen/bbs; 
  177.     location ~ .*\.(php|php5)?$ 
  178.     { 
  179.       #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  180.       fastcgi_pass  127.0.0.1:9000; 
  181.       fastcgi_index index.php; 
  182.       include fcgi.conf; 
  183.     } 
  184.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  185.     { 
  186.       expires      30d; 
  187.     } 
  188.     location ~ .*\.(js|css)?$ 
  189.     { 
  190.       expires      1h; 
  191.     } 
  192.     access_log  off; 
  193.     } 
  194. server 
  195.   { 
  196.     listen       80; 
  197.     server_name  baobei.wqueen.cn; 
  198.     index index.html index.htm index.php; 
  199.     root  /data/htdocs/www/baobei; 
  200.     location ~ .*\.(php|php5)?$ 
  201.     { 
  202.       #fastcgi_pass  unix:/tmp/php-cgi.sock; 
  203.       fastcgi_pass  127.0.0.1:9000; 
  204.       fastcgi_index index.php; 
  205.       include fcgi.conf; 
  206.     } 
  207.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 
  208.     { 
  209.       expires      30d; 
  210.     } 
  211.     location ~ .*\.(js|css)?$ 
  212.     { 
  213.       expires      1h; 
  214.     } 
  215.     access_log  off; 
  216.     } 

 

阅读(7838) | 评论(1) | 转发(9) |
给主人留下些什么吧!~~

十七岁的回忆2011-12-15 22:38:54

多虚拟主机?