Commit 2fc157de authored by omega8cc's avatar omega8cc

Issue #1544144 by thsutton - Use $server_name instead of $host in all sites/...

Issue #1544144 by thsutton - Use $server_name instead of $host in all sites/ paths to avoid broken URLs to static files for domain aliases in D7 (Nginx).
parent 55bb97ed
......@@ -39,7 +39,7 @@ location = /favicon.ico {
access_log off;
log_not_found off;
expires 30d;
try_files /sites/$host/files/favicon.ico $uri =204;
try_files /sites/$server_name/files/favicon.ico $uri =204;
}
###
......@@ -49,7 +49,7 @@ location = /favicon.ico {
location = /robots.txt {
access_log off;
log_not_found off;
try_files /sites/$host/files/robots.txt $uri @cache;
try_files /sites/$server_name/files/robots.txt $uri @cache;
}
###
......@@ -213,9 +213,9 @@ location ~* /(?:external|system|files/imagecache|files/styles)/ {
log_not_found off;
expires 30d;
# fix common problems with old paths after import from standalone to Aegir multisite
rewrite ^/sites/(.*)/files/imagecache/(.*)/sites/default/files/(.*)$ /sites/$host/files/imagecache/$2/$3 last;
rewrite ^/files/imagecache/(.*)$ /sites/$host/files/imagecache/$1 last;
rewrite ^/files/styles/(.*)$ /sites/$host/files/styles/$1 last;
rewrite ^/sites/(.*)/files/imagecache/(.*)/sites/default/files/(.*)$ /sites/$server_name/files/imagecache/$2/$3 last;
rewrite ^/files/imagecache/(.*)$ /sites/$server_name/files/imagecache/$1 last;
rewrite ^/files/styles/(.*)$ /sites/$server_name/files/styles/$1 last;
add_header X-Header "IC Generator 1.0";
set $nocache_details "Skip";
try_files $uri @drupal;
......@@ -274,7 +274,7 @@ location ~* files/advagg_(?:css|js)/ {
access_log off;
expires max;
limit_conn gulag 88;
rewrite ^/files/advagg_(.*)/(.*)$ /sites/$host/files/advagg_$1/$2 last;
rewrite ^/files/advagg_(.*)/(.*)$ /sites/$server_name/files/advagg_$1/$2 last;
add_header ETag "";
add_header Cache-Control "max-age=290304000, no-transform, public";
add_header Last-Modified "Wed, 20 Jan 1988 04:20:42 GMT";
......@@ -355,10 +355,10 @@ location ~* ^.+\.(?:jpe?g|gif|png|ico|bmp|svg|swf|pdf|docx?|xlsx?|pptx?|tiff?|tx
expires 30d;
add_header Access-Control-Allow-Origin *;
# allow files/images/downloads to be accessed without /sites/fqdn/
rewrite ^/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/images/(.*)$ /sites/$host/files/images/$1 last;
rewrite ^/downloads/(.*)$ /sites/$host/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/files/(.*)$ /sites/$server_name/files/$1 last;
rewrite ^/images/(.*)$ /sites/$server_name/files/images/$1 last;
rewrite ^/downloads/(.*)$ /sites/$server_name/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$server_name/files/$1 last;
try_files $uri =404;
}
......@@ -371,9 +371,9 @@ location ~* ^.+\.(?:avi|mpe?g|mov|wmv|mp3|mp4|m4a|ogg|ogv|flv|wav|midi|zip|tar|t
tcp_nodelay off;
add_header Access-Control-Allow-Origin *;
# allow files/downloads to be accessed without /sites/fqdn/
rewrite ^/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/downloads/(.*)$ /sites/$host/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/files/(.*)$ /sites/$server_name/files/$1 last;
rewrite ^/downloads/(.*)$ /sites/$server_name/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$server_name/files/$1 last;
try_files $uri =404;
}
......@@ -532,6 +532,7 @@ location = /index.php {
add_header X-Speed-Cache-Key "$key_uri";
add_header X-NoCache "$nocache_details";
add_header X-This-Proto "$http_x_forwarded_proto";
add_header X-Server-Name "$server_name";
###
### Use Nginx cache for all visitors.
###
......
......@@ -39,7 +39,7 @@ location = /favicon.ico {
access_log off;
log_not_found off;
expires 30d;
try_files /sites/$host/files/favicon.ico $uri =204;
try_files /sites/$server_name/files/favicon.ico $uri =204;
}
###
......@@ -49,7 +49,7 @@ location = /favicon.ico {
location = /robots.txt {
access_log off;
log_not_found off;
try_files /sites/$host/files/robots.txt $uri @cache;
try_files /sites/$server_name/files/robots.txt $uri @cache;
}
###
......@@ -199,9 +199,9 @@ location ~* /(?:external|system|files/imagecache|files/styles)/ {
log_not_found off;
expires 30d;
# fix common problems with old paths after import from standalone to Aegir multisite
rewrite ^/sites/(.*)/files/imagecache/(.*)/sites/default/files/(.*)$ /sites/$host/files/imagecache/$2/$3 last;
rewrite ^/files/imagecache/(.*)$ /sites/$host/files/imagecache/$1 last;
rewrite ^/files/styles/(.*)$ /sites/$host/files/styles/$1 last;
rewrite ^/sites/(.*)/files/imagecache/(.*)/sites/default/files/(.*)$ /sites/$server_name/files/imagecache/$2/$3 last;
rewrite ^/files/imagecache/(.*)$ /sites/$server_name/files/imagecache/$1 last;
rewrite ^/files/styles/(.*)$ /sites/$server_name/files/styles/$1 last;
add_header X-Header "IC Generator 1.0";
set $nocache_details "Skip";
try_files $uri @drupal;
......@@ -260,7 +260,7 @@ location ~* files/advagg_(?:css|js)/ {
access_log off;
expires max;
limit_conn gulag 88;
rewrite ^/files/advagg_(.*)/(.*)$ /sites/$host/files/advagg_$1/$2 last;
rewrite ^/files/advagg_(.*)/(.*)$ /sites/$server_name/files/advagg_$1/$2 last;
add_header ETag "";
add_header Cache-Control "max-age=290304000, no-transform, public";
add_header Last-Modified "Wed, 20 Jan 1988 04:20:42 GMT";
......@@ -341,10 +341,10 @@ location ~* ^.+\.(?:jpe?g|gif|png|ico|bmp|svg|swf|pdf|docx?|xlsx?|pptx?|tiff?|tx
expires 30d;
add_header Access-Control-Allow-Origin *;
# allow files/images/downloads to be accessed without /sites/fqdn/
rewrite ^/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/images/(.*)$ /sites/$host/files/images/$1 last;
rewrite ^/downloads/(.*)$ /sites/$host/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/files/(.*)$ /sites/$server_name/files/$1 last;
rewrite ^/images/(.*)$ /sites/$server_name/files/images/$1 last;
rewrite ^/downloads/(.*)$ /sites/$server_name/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$server_name/files/$1 last;
try_files $uri =404;
}
......@@ -357,9 +357,9 @@ location ~* ^.+\.(?:avi|mpe?g|mov|wmv|mp3|mp4|m4a|ogg|ogv|flv|wav|midi|zip|tar|t
tcp_nodelay off;
add_header Access-Control-Allow-Origin *;
# allow files/downloads to be accessed without /sites/fqdn/
rewrite ^/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/downloads/(.*)$ /sites/$host/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$host/files/$1 last;
rewrite ^/files/(.*)$ /sites/$server_name/files/$1 last;
rewrite ^/downloads/(.*)$ /sites/$server_name/files/downloads/$1 last;
rewrite ^/.+/sites/.+/files/(.*)$ /sites/$server_name/files/$1 last;
try_files $uri =404;
}
......@@ -518,6 +518,7 @@ location = /index.php {
add_header X-Speed-Cache-Key "$key_uri";
add_header X-NoCache "$nocache_details";
add_header X-This-Proto "$http_x_forwarded_proto";
add_header X-Server-Name "$server_name";
###
### Use Nginx cache for all visitors.
###
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment