生产环境下的nginx.conf配置文件(多虚拟主机)-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 537051
  • 博文数量: 48
  • 博客积分: 1249
  • 博客等级: 中尉
  • 技术积分: 1926
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-04 10:22
文章存档

2012年(3)

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

 

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

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

多虚拟主机?

|
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图