跳转到主要内容
cndsjz 提交于 13 September 2014

nginx环境下,drupal缩略图出不来,新建一个适合drupal的conf内容:

location ~ [^/]\.php(/|$)
                        {
                                # comment try_files $uri =404; to enable pathinfo
                                try_files $uri =404;
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fastcgi.conf;
                                #include pathinfo.conf;
                        }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }


//复写是这个:


if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?q=$1 last;
    }

//如果要支持boost,还有另外一段:

set $boost "";
set $boost_query "_";

if ( $request_method = GET ) {
    set $boost G;
  }

  if ($http_cookie !~ "DRUPAL_UID") {
    set $boost "${boost}D";
  }

  if ($query_string = "") {
    set $boost "${boost}Q";
  }

  if ( -f $document_root/cache/normal/$host$request_uri$boost_query.html ) {
    set $boost "${boost}F";
  }

  if ($boost = GDQF){
    rewrite ^.*$ /cache/normal/$host/$request_uri$boost_query.html break;
  }

  if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?q=$1 last;
      break;
  }	

 

非常感谢Boy提供这段代码,完美解决nginx下缩略图问题

标签
Drupal 版本