Помогите настроить nginx +apache + memchached
При включении nginx захожу на любой поддомен и попадаю на домен 2 го уровня. Как правильно nginx в конфигах указать чтобы он отдавал поддомены правильно
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 [user=backend]backend[/user];
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 = [user=backend]backend[/user];
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 = [user=backend]backend[/user];
}
location [user=rewrite]rewrite[/user] {
# 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 [user=cache]cache[/user] {
if ($http_cookie ~ "DRUPAL_UID" ) {
return 405;
}
if ($request_method !~ ^(GET|HEAD)$ ) {
return 405;
}
error_page 405 = [user=backend]backend[/user];
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 [user=backend]backend[/user];
}
location [user=backend]backend[/user] {
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;
}