summaryrefslogtreecommitdiffstats
path: root/docs/HINTS.txt
blob: 29503db61fdd5911dccbe98e2a13c3149a326b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
### How to customize/override standard rewrites and locations in Nginx
#
# NOTE: Since BOA-2.0.4 all listed below options are available
#       both for Satellite and Master Aegir Instances.
#
# You can include your custom rewrites/locations configuration
# to modify or add some custom settings taking precedence
# over other rules in the main Nginx configuration.
#
# Note that some locations will require using parent literal location
# to stop searching for / using other regex based locations.
#
# To learn more please read: http://wiki.nginx.org/HttpCoreModule#location
#
# Your custom include file should have filename: nginx_vhost_include.conf
# for standard overrides and/or nginx_force_include.conf for high level
# overrides. The difference between both options is only the point
# where the extra config file is included, thus nginx_force_include.conf
# can override more than nginx_vhost_include.conf file.
#
# Both include points: http://bit.ly/WlOQRy and http://bit.ly/UrfDwu
#
# Nginx will look for both files in the include directory specified below:
#
# For Satellite Instances:
# /data/disk/EDIT_USER/config/server_master/nginx/post.d/
#
# For Master Instance:
# /var/aegir/config/includes/
#
# These files will be included if exist and will never be modified
# or touched by Aegir Provision backend system.
#
# Note: your custom rewrite rules will apply to *all* sites
# on the same Aegir Satellite Instance, unless you will use
# site/domain specific if{} embedded locations, as shown
# in the examples below.
#

###
### Custom rewrites to map legacy content to the Drupal multisite.
###
location ~* ^.+\.(?:jpe?g|gif|png|ico|swf|pdf|ttf|html?)$ {
  access_log off;
  expires    30d;
  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    ^/download/(.*)$  /sites/$server_name/files/download/$1 last;
  rewrite    ^/docs/(.*)$      /sites/$server_name/files/docs/$1 last;
  rewrite    ^/documents/(.*)$ /sites/$server_name/files/documents/$1 last;
  rewrite    ^/legacy/(.*)$    /sites/$server_name/files/legacy/$1 last;
  try_files  $uri =404;
}

###
### Site specific 301 redirect with parent literal location
### to stop searching for (and using) other regex based locations.
###
location ^~ /some-literal-path/no-regex-here {
  location ~* ^/some-path/or-regex-here {
    if ($host ~* ^(www\.)?(domain\.com)$) {
      rewrite ^ $scheme://$host/destination/url permanent;
    }
    try_files $uri @cache;
  }
}

###
### Site specific 301 redirect for various legacy .php URIs with parent literal
### locations to stop searching for (and using) other regex based locations.
###
location ^~ /services {
  location ~* ^/services {
    if ($host ~* ^(www\.)?(foo\.com)$) {
      rewrite ^/services/accounting\.php$ $scheme://$host/node/18 permanent;
      rewrite ^/services/assurance\.php$  $scheme://$host/node/11 permanent;
      rewrite ^/services/audit\.php$      $scheme://$host/node/11 permanent;
      rewrite ^/services/taxation\.php$   $scheme://$host/node/92 permanent;
      rewrite ^/services/wealth\.php$     $scheme://$host/node/15 permanent;
      rewrite ^/services\.php$            $scheme://$host/node/17 permanent;
    }
    try_files $uri @cache;
  }
  try_files $uri @cache;
}
location ^~ /our_team {
  location ~* ^/our_team {
    if ($host ~* ^(www\.)?(foo\.com)$) {
      rewrite ^/our_team\.php$ $scheme://$host/node/10 permanent;
      rewrite ^/our_team$      $scheme://$host/node/10 permanent;
    }
    try_files $uri @cache;
  }
  try_files $uri @cache;
}
location = /about_us.php {
  if ($host ~* ^(www\.)?(foo\.com)$) {
    rewrite ^ $scheme://$host/node/19 permanent;
  }
  return 403;
}