Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Projects
Groups
Snippets
Sign up now
Login
Sign in
Toggle navigation
Menu
Open sidebar
project
provision
Commits
594771a4
Commit
594771a4
authored
Feb 19, 2015
by
Grazyna Jaworska
Browse files
Nginx: Sync configuration improvements.
parent
e66aa066
Changes
4
Hide whitespace changes
Inline
Side-by-side
http/Provision/Config/Nginx/Inc/vhost_include.tpl.php
View file @
594771a4
...
...
@@ -677,6 +677,38 @@ location @uncached {
### Map /files/ shortcut early to avoid overrides in other locations.
###
location ^~ /files/ {
###
### Sub-location to support files/styles with short URIs.
###
location ~* /files/styles/(.*)$ {
access_log off;
log_not_found off;
expires 30d;
<?php
if
(
$nginx_config_mode
==
'extended'
)
:
?>
set $nocache_details "Skip";
<?php
endif
;
?>
rewrite ^/files/(.*)$ /sites/$main_site_name/files/$1 last;
try_files /sites/$main_site_name/files/styles/$1 $uri @drupal;
}
###
### Sub-location to support files/imagecache with short URIs.
###
location ~* /files/imagecache/(.*)$ {
access_log off;
log_not_found off;
expires 30d;
<?php
if
(
$nginx_config_mode
==
'extended'
)
:
?>
# fix common problems with old paths after import from standalone to Aegir multisite
rewrite ^/files/imagecache/(.*)/sites/default/files/(.*)$ /sites/$main_site_name/files/imagecache/$1/$2 last;
rewrite ^/files/imagecache/(.*)/files/(.*)$ /sites/$main_site_name/files/imagecache/$1/$2 last;
set $nocache_details "Skip";
<?php
endif
;
?>
rewrite ^/files/(.*)$ /sites/$main_site_name/files/$1 last;
try_files /sites/$main_site_name/files/imagecache/$1 $uri @drupal;
}
location ~* ^.+\.(?:pdf|jpe?g|gif|png|ico|bmp|svg|swf|docx?|xlsx?|pptx?|tiff?|txt|rtf|cgi|bat|pl|dll|class|otf|ttf|woff|eot|less|avi|mpe?g|mov|wmv|mp3|ogg|ogv|wav|midi|zip|tar|t?gz|rar|dmg|exe|apk|pxl|ipa)$ {
expires 30d;
tcp_nodelay off;
...
...
http/Provision/Config/Nginx/Ssl/vhost_ssl.tpl.php
View file @
594771a4
...
...
@@ -28,7 +28,7 @@ server {
rewrite ^ $scheme://
<?php
print
$this
->
redirection
;
?>
$request_uri? permanent;
}
<?php
endforeach
;
?>
<?php
endif
?>
<?php
endif
;
?>
server {
include fastcgi_params;
...
...
http/Provision/Config/Nginx/server.tpl.php
View file @
594771a4
...
...
@@ -205,7 +205,7 @@ map $http_user_agent $device {
### Set a cache_uid variable for authenticated users (by @brianmercer and @perusio, fixed by @omega8cc).
###
map $http_cookie $cache_uid {
default
'';
default '';
~SESS[[:alnum:]]+=(?
<session_id>
[[:graph:]]+) $session_id;
}
...
...
@@ -222,8 +222,9 @@ map $request_uri $key_uri {
###
map $http_user_agent $is_crawler {
default '';
~*HTTrack|BrokenLinkCheck|2009042316.*Firefox.*3\.0\.10|MJ12|HTMLParser|PECL|Automatic|CCBot is_crawler;
~*SiteBot|BuzzTrack|Sistrix|Offline|Nutch|Mireo|SWEB|Morfeus|GSLFbot|HiScan|Riddler|DBot is_crawler;
~*HTTrack|BrokenLinkCheck|2009042316.*Firefox.*3\.0\.10|MJ12|HTMLParser is_crawler;
~*SiteBot|PECL|Automatic|CCBot|BuzzTrack|Sistrix|Offline|Nutch|Mireo is_crawler;
~*SWEB|Morfeus|GSLFbot|HiScan|Riddler|DBot|SEOkicks|PChomebot is_crawler;
}
###
...
...
@@ -239,7 +240,7 @@ map $http_referer $is_botnet {
### Deny all known bots/spiders on some URIs.
###
map $http_user_agent $is_bot {
default
'';
default '';
~*crawl|bot|spider|tracker|click|parser|google|yahoo|yandex|baidu|bing is_bot;
}
...
...
@@ -255,7 +256,7 @@ map $http_user_agent $deny_on_high_load {
### Deny listed requests for security reasons.
###
map $args $is_denied {
default
'';
default '';
~*delete.+from|insert.+into|select.+from|union.+select|onload|\.php.+src|system\(.+|document\.cookie|\;|\.\. is_denied;
}
<?php
endif
;
?>
...
...
http/Provision/Config/Nginx/subdir.tpl.php
View file @
594771a4
...
...
@@ -417,6 +417,59 @@ location ^~ /<?php print $subdir; ?> {
}
<?php
endif
;
?>
###
### Map /
<?php
print
$subdir
;
?>
/files/ shortcut early to avoid overrides in other locations.
###
location ^~ /
<?php
print
$subdir
;
?>
/files/ {
###
### Sub-location to support files/styles with short URIs.
###
location ~* /
<?php
print
$subdir
;
?>
/files/styles/(.*)$ {
access_log off;
log_not_found off;
expires 30d;
<?php
if
(
$nginx_config_mode
==
'extended'
)
:
?>
set $nocache_details "Skip";
<?php
endif
;
?>
rewrite ^/
<?php
print
$subdir
;
?>
/files/(.*)$ /
<?php
print
$subdir
;
?>
/sites/$main_site_name/files/$1 last;
try_files /
<?php
print
$subdir
;
?>
/sites/$main_site_name/files/styles/$1 $uri @drupal_
<?php
print
$subdir
;
?>
;
}
###
### Sub-location to support files/imagecache with short URIs.
###
location ~* /
<?php
print
$subdir
;
?>
/files/imagecache/(.*)$ {
access_log off;
log_not_found off;
expires 30d;
<?php
if
(
$nginx_config_mode
==
'extended'
)
:
?>
# fix common problems with old paths after import from standalone to Aegir multisite
rewrite ^/
<?php
print
$subdir
;
?>
/files/imagecache/(.*)/sites/default/files/(.*)$ /
<?php
print
$subdir
;
?>
/sites/$main_site_name/files/imagecache/$1/$2 last;
rewrite ^/
<?php
print
$subdir
;
?>
/files/imagecache/(.*)/files/(.*)$ /
<?php
print
$subdir
;
?>
/sites/$main_site_name/files/imagecache/$1/$2 last;
set $nocache_details "Skip";
<?php
endif
;
?>
rewrite ^/
<?php
print
$subdir
;
?>
/files/(.*)$ /
<?php
print
$subdir
;
?>
/sites/$main_site_name/files/$1 last;
try_files /
<?php
print
$subdir
;
?>
/sites/$main_site_name/files/imagecache/$1 $uri @drupal_
<?php
print
$subdir
;
?>
;
}
location ~* ^.+\.(?:pdf|jpe?g|gif|png|ico|bmp|svg|swf|docx?|xlsx?|pptx?|tiff?|txt|rtf|cgi|bat|pl|dll|class|otf|ttf|woff|eot|less|avi|mpe?g|mov|wmv|mp3|ogg|ogv|wav|midi|zip|tar|t?gz|rar|dmg|exe|apk|pxl|ipa)$ {
expires 30d;
tcp_nodelay off;
access_log off;
log_not_found off;
add_header Access-Control-Allow-Origin *;
rewrite ^/
<?php
print
$subdir
;
?>
/files/(.*)$ /
<?php
print
$subdir
;
?>
/sites/$main_site_name/files/$1 last;
try_files $uri =404;
}
<?php
if
(
$nginx_config_mode
==
'extended'
)
:
?>
try_files $uri @cache_
<?php
print
$subdir
;
?>
;
<?php
else
:
?>
try_files $uri @drupal_
<?php
print
$subdir
;
?>
;
<?php
endif
;
?>
}
###
### Imagecache and imagecache_external support.
###
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment