nginx-site.conf 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # ddev php default (PHP project type) config
  2. # If you want to take over this file and customize it, remove the line above
  3. # and ddev will respect it and won't overwrite the file.
  4. # See https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#custom-nginx-configuration
  5. server {
  6. listen 80 default_server;
  7. listen 443 ssl default_server;
  8. root /var/www/html/public;
  9. ssl_certificate /etc/ssl/certs/master.crt;
  10. ssl_certificate_key /etc/ssl/certs/master.key;
  11. include /etc/nginx/monitoring.conf;
  12. index index.php index.htm index.html;
  13. # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
  14. sendfile off;
  15. error_log /dev/stdout info;
  16. access_log /var/log/nginx/access.log;
  17. location / {
  18. absolute_redirect off;
  19. if (!-e $request_filename){
  20. rewrite ^(.*)$ /index.php?s=$1 last; break;
  21. }
  22. }
  23. location @rewrite {
  24. # For D7 and above:
  25. # Clean URLs are handled in drupal_environment_initialize().
  26. rewrite ^ /index.php;
  27. }
  28. # pass the PHP scripts to FastCGI server listening on socket
  29. location ~ \.php$ {
  30. try_files $uri =404;
  31. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  32. fastcgi_pass unix:/run/php-fpm.sock;
  33. fastcgi_buffers 16 16k;
  34. fastcgi_buffer_size 32k;
  35. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  36. fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  37. fastcgi_index index.php;
  38. include fastcgi_params;
  39. fastcgi_intercept_errors off;
  40. # fastcgi_read_timeout should match max_execution_time in php.ini
  41. fastcgi_read_timeout 10m;
  42. fastcgi_param SERVER_NAME $host;
  43. fastcgi_param HTTPS $fcgi_https;
  44. # Pass the X-Accel-* headers to facilitate testing.
  45. fastcgi_pass_header "X-Accel-Buffering";
  46. fastcgi_pass_header "X-Accel-Charset";
  47. fastcgi_pass_header "X-Accel-Expires";
  48. fastcgi_pass_header "X-Accel-Limit-Rate";
  49. fastcgi_pass_header "X-Accel-Redirect";
  50. }
  51. # Prevent clients from accessing hidden files (starting with a dot)
  52. # This is particularly important if you store .htpasswd files in the site hierarchy
  53. # Access to `/.well-known/` is allowed.
  54. # https://www.mnot.net/blog/2010/04/07/well-known
  55. # https://tools.ietf.org/html/rfc5785
  56. location ~* /\.(?!well-known\/) {
  57. deny all;
  58. }
  59. # Prevent clients from accessing to backup/config/source files
  60. location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
  61. deny all;
  62. }
  63. include /etc/nginx/common.d/*.conf;
  64. include /mnt/ddev_config/nginx/*.conf;
  65. }