Помогите настроить nginx для Drupal

heiheshang nginx-forum at nginx.us
Fri Nov 7 03:19:55 UTC 2014


Для главного домена все работает, для домена 3 уровня css не отдается. Хотя
что для 2 что для 3 уровня css один. 
server {
 
  listen 80;
 
  root /var/www/html;
 
  server_name 123.com *.123.com;
 
  ssi on;
  ssi_silent_errors on;
 
  location ~ ^/sites/.*/private/ {
	return 403;
  }
 
 
  location ~ (^|/)\. {
	return 403;
  }
 
 
  location ~ /sites/.*/files/styles/ {
	try_files $uri @backend;
	expires 30d;
	log_not_found off;
  }
 
 
  location ~*
\.(png|gif|jpg|jpeg|css|js|ico|swf|flw|cgi|bat|pl|dll|exe|asp)$ {
	try_files $uri =404;
	expires 30d;
	log_not_found off;
  }
 
 
  location / {
 
 
	error_page 418 = @backend;
 
	if ($http_cookie ~* "SESS") {
  	return 418;
	}
 
	if ($request_method !~ ^(GET|HEAD)$ ) {
  	return 418;
	}
 
 
	default_type text/html;
 
	add_header X-Nginx-Page-Cache HIT;
 
 
	# set $memcached_key
"PREFIX-cache_page-$scheme://$server_name$uri$is_args$args";
	set $memcached_key "cache_page-$scheme://$server_name$uri$is_args$args";
 
	http://nginx.org/ru/docs/http/ngx_http_memcached_module.html
 
	memcached_pass unix:/var/run/memcached/memcached.socket1;
 
	proxy_intercept_errors on;
	error_page 404 502 = @backend;
  }
location @rewrite {
# You have 2 options here
# For D7 and above:
# Clean URLs are handled in drupal_environment_initialize().
rewrite ^ /index.php;
# For Drupal 6 and bwlow:
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
#rewrite ^/(.*)$ /index.php?q=$1;
} 
 
     location @cache {
 
    if ($http_cookie ~ "DRUPAL_UID" ) {
        return 405;
    }
    if ($request_method !~ ^(GET|HEAD)$ ) {
        return 405;
    }
    error_page 405 = @backend;
    gzip on;
    add_header Expires "Tue, 22 Sep 1974 08:00:00 GMT";
    add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
    try_files /cache/normal/$host/${uri}_.html /cache/perm/$host/${uri}_.css
/cache/perm/$host/${uri}_.js /cache/$host/0$uri.html
/cache/$host/0${uri}/index.html @backend;
    }
 
  location @backend {
 
 
	add_header X-Nginx-Page-Cache MISS;
 
	proxy_pass         	http://127.0.0.1:8080;
	proxy_connect_timeout   120;
	proxy_send_timeout 	120;
	proxy_read_timeout 	180;
 
	proxy_set_header  Host              	$host;
	proxy_set_header  X-Real-IP         	$remote_addr;
	proxy_set_header  X-Forwarded-For   	$proxy_add_x_forwarded_for;
  }
}
 
server {
server_name www.123.com;
return 301 $scheme://123.com$request_uri;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,254653,254653#msg-254653



Подробная информация о списке рассылки nginx-ru