### 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; }