Nginx 服务器 Drupal 站点配置文件

我自己的 Nginx 服务器中 Drupal 7 站点的配置文件(/etc/nginx/conf.d/domain.conf),仅供参考:

server {
    server_name domain.com;
    rewrite  ^/(.*)$  http://www.domain.com/$1 permanent;
}
server {
    listen       80;
    server_name  www.domain.com;
    root   /home/user/www/domain.com;
    index index.php index.html index.htm;

    location ~ ^/sites/.*/private/ {
            return 403;
    }
    location ~ (^|/)\. {
            return 403;
    }
    location / {
        index index.php;
        try_files $uri $uri/ @rewrite;
      }
    location @rewrite {
        rewrite ^ /index.php;
    }
    location ~ ^/sites/.*/files/styles/ {
            try_files $uri @rewrite;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}