杭州神话信息技术有限公司

标题: 发一个nginx下的伪静态规则(包含虚拟机配置) [打印本页]

作者: shenyukun    时间: 2010-12-29 18:48:55     标题: 发一个nginx下的伪静态规则(包含虚拟机配置)

server
  {
    listen       80;
    server_name  www.yeyaotuan.com yeyaotuan.com;
    index index.html index.php;
    root  /web/www/tuangou;
           #limit_conn   crawler  20;   
    autoindex on;
        
        if (-f $request_filename/index.html){
            rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }
  
   
       if (!-e $request_filename) {
return 404;
}                     
    location ~ .*\.(php|php5)?$
    {      
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
   
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1d;
    }   
    log_format  www.yeyaotuan.com  '$remote_addr - $remote_user [$time_local] "$request" '
              '$status $body_bytes_sent "$http_referer" '
              '"$http_user_agent" $http_x_forwarded_for';
    access_log  /web/logs/www.yeyaotuan.com.log  www.yeyaotuan.com;
  }




欢迎光临 杭州神话信息技术有限公司 (http://www.cenwor.com/) Powered by Discuz! X2