|
1 | 1 | server { |
2 | | - listen 80; |
| 2 | + listen 80; |
3 | 3 | listen [::]:80; |
4 | 4 |
|
5 | | - server_name site_a.dev; |
6 | | - root /var/www/site_a; |
7 | | - index index.php; |
| 5 | + #domain name |
| 6 | + server_name drupal8.dev; |
8 | 7 |
|
| 8 | + #file document root. This has to match one of the volumes in docer-composer.yml |
| 9 | + root /var/www/drupal8; |
| 10 | + |
| 11 | + # This is the full path to your index file |
| 12 | + index index.php index.html index.htm; |
| 13 | + |
| 14 | + |
| 15 | + ## serve imagecache files directly or redirect to drupal if they do not exist. |
| 16 | + location ~* files/styles { |
| 17 | + access_log off; |
| 18 | + expires 30d; |
| 19 | + try_files $uri @drupal; |
| 20 | + } |
| 21 | + |
| 22 | + ## serve imagecache files directly or redirect to drupal if they do not exist. |
| 23 | + location ~* ^.+.(xsl|xml)$ { |
| 24 | + access_log off; |
| 25 | + expires 1d; |
| 26 | + try_files $uri @drupal; |
| 27 | + } |
| 28 | + |
| 29 | + ## Images and static content is treated different |
| 30 | + location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { |
| 31 | + access_log off; |
| 32 | + expires 30d; |
| 33 | + } |
9 | 34 |
|
10 | 35 | location / { |
11 | | - try_files $uri $uri/ /index.php?q=$uri&$args; |
| 36 | + index index.php; |
| 37 | + # This is cool because no php is touched for static content |
| 38 | + try_files $uri $uri/ @rewrite; |
| 39 | + expires max; |
12 | 40 | } |
13 | 41 |
|
14 | | - error_page 404 /404.html; |
15 | | - error_page 500 502 503 504 /50x.html; |
16 | | - location = /50x.html { |
17 | | - root /var/www/site_a; |
| 42 | + location @drupal { |
| 43 | + rewrite ^/(.*)$ /index.php?q=$1 last; |
18 | 44 | } |
19 | 45 |
|
20 | | - location ~ [^/]\.php(/|$) { |
21 | | - fastcgi_split_path_info ^(.+?\.php)(/.*)$; |
22 | | - if (!-f $document_root$fastcgi_script_name) { |
23 | | - return 404; |
24 | | - } |
25 | 46 |
|
| 47 | + location @rewrite { |
| 48 | + # Some modules enforce no slash (/) at the end of the URL |
| 49 | + # Else this rewrite block wouldn't be needed (GlobalRedirect) |
| 50 | + rewrite ^/(.*)$ /index.php?q=$1; |
| 51 | + } |
| 52 | + |
| 53 | + location ~ .php$ { |
26 | 54 | fastcgi_pass php-upstream; |
27 | 55 | fastcgi_index index.php; |
28 | 56 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
|
0 commit comments