Настройки хоста Nginx + php7.0-fpm для мультисайтинга на Друпал 8

Drupal: 

В первой сроке задаётся Wild-card для домена сайт.рф
Другие конфигурационные файлы сервера (/etc/nginx/nginx.conf, /etc/nginx/fastcgi_params) указаны в статье установка и конфигурация VPS Debian Nginx PHP7.0-FPM.

Листинг /etc/nginx/sites-available/xn--80aswg.xn--p1ai
  1. server {
  2. server_name *.xn--80aswg.xn--p1ai www.xn--80aswg.xn--p1ai; #multisiting
  3. root /home/master/domains/xn--80aswg.xn--p1ai/www;
  4.  
  5. error_log /home/master/domains/xn--80aswg.xn--p1ai/log/error.log warn;
  6. access_log off;
  7.  
  8.  
  9. location = /favicon.ico {
  10. log_not_found off;
  11. access_log off;
  12. }
  13.  
  14. location = /robots.txt {
  15. allow all;
  16. log_not_found off;
  17. access_log off;
  18. }
  19.  
  20. # Very rarely should these ever be accessed outside of your lan
  21. location ~* \.(txt|log)$ {
  22. allow 192.168.0.0/16;
  23. deny all;
  24. }
  25.  
  26. location ~ \..*/.*\.php$ {
  27. return 403;
  28. }
  29.  
  30. location ~ ^/sites/.*/private/ {
  31. return 403;
  32. }
  33.  
  34. location ~ (^|/)\. {
  35. return 403;
  36. }
  37.  
  38. location / {
  39. try_files $uri /index.php?$query_string; # For Drupal >= 7
  40. }
  41.  
  42. location @rewrite {
  43. rewrite ^/(.*)$ /index.php?q=$1;
  44. }
  45.  
  46. # Don't allow direct access to PHP files in the vendor directory.
  47. location ~ /vendor/.*\.php$ {
  48. deny all;
  49. return 404;
  50. }
  51.  
  52. location ~ '\.php$|^/update.php' {
  53. fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
  54. include /etc/nginx/fastcgi_params;
  55.  
  56. fastcgi_param SCRIPT_FILENAME /home/master/domains/xn--80aswg.xn--p1ai/www$fastcgi_script_name;
  57. fastcgi_param DOCUMENT_ROOT /home/master/domains/xn--80aswg.xn--p1ai/www;
  58.  
  59. fastcgi_param PHP_ADMIN_VALUE upload_tmp_dir=/home/master/domains/xn--80aswg.xn--p1ai/tmp/upload;
  60. fastcgi_param PHP_ADMIN_VALUE session.save_path=/home/master/domains/xn--80aswg.xn--p1ai/tmp/sessions;
  61. }
  62.  
  63. # Fighting with Styles? This little gem is amazing.
  64. location ~ ^/images/styles/ { # For Drpal >= 7
  65. try_files $uri @rewrite;
  66. }
  67.  
  68. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
  69. expires max;
  70. log_not_found off;
  71. }
  72. }

 
Официальная документация по настройке хоста Drupal 8 на сервере Nginx + php-fpm: https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/

Рубрика: