github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/pkg/ddevapp/testdata/TestConfigOverrideDetection/.ddev/nginx_full/nginx-site.conf (about)

     1  # ddev drupal7 config
     2  
     3  # This has been customized.
     4  # If you want to take over this file and customize it, remove the line above
     5  # and ddev will respect it and won't overwrite the file.
     6  # See https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#providing-custom-nginx-configuration
     7  
     8  # Set https to 'on' if x-forwarded-proto is https
     9  map $http_x_forwarded_proto $fcgi_https {
    10      default off;
    11      https on;
    12  }
    13  
    14  
    15  server {
    16      listen 80 default_server;
    17      listen 443 ssl default_server;
    18  
    19      root /var/www/html;
    20  
    21      ssl_certificate /etc/ssl/certs/master.crt;
    22      ssl_certificate_key /etc/ssl/certs/master.key;
    23  
    24      include /etc/nginx/monitoring.conf;
    25  
    26      index index.php index.htm index.html;
    27  
    28      # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
    29      sendfile off;
    30      error_log /dev/stdout info;
    31      access_log /var/log/nginx/access.log;
    32  
    33      location / {
    34          absolute_redirect off;
    35  
    36          # First attempt to serve request as file, then
    37          # as directory, then fall back to index.html
    38          try_files $uri $uri/ /index.php?q=$uri&$args;
    39      }
    40  
    41      location @rewrite {
    42          # For D7 and above:
    43          # Clean URLs are handled in drupal_environment_initialize().
    44          rewrite ^ /index.php;
    45      }
    46  
    47      # Handle image styles for Drupal 7+
    48      location ~ ^/sites/.*/files/styles/ {
    49          try_files $uri @rewrite;
    50      }
    51  
    52      # pass the PHP scripts to FastCGI server listening on socket
    53      location ~ \.php$ {
    54          try_files $uri =404;
    55          fastcgi_split_path_info ^(.+\.php)(/.+)$;
    56          fastcgi_pass unix:/run/php-fpm.sock;
    57          fastcgi_buffers 16 16k;
    58          fastcgi_buffer_size 32k;
    59          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    60          fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    61          fastcgi_index index.php;
    62          include fastcgi_params;
    63          fastcgi_intercept_errors off;
    64          # fastcgi_read_timeout should match max_execution_time in php.ini
    65          fastcgi_read_timeout 10m;
    66          fastcgi_param SERVER_NAME $host;
    67          fastcgi_param HTTPS $fcgi_https;
    68      }
    69  
    70      # Expire rules for static content
    71      # Feed
    72      location ~* \.(?:rss|atom)$ {
    73          expires 1h;
    74      }
    75  
    76      # Media: images, icons, video, audio, HTC
    77      location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
    78          try_files $uri @rewrite;
    79          expires max;
    80          log_not_found off;
    81      }
    82  
    83      # Prevent clients from accessing hidden files (starting with a dot)
    84      # This is particularly important if you store .htpasswd files in the site hierarchy
    85      # Access to `/.well-known/` is allowed.
    86      # https://www.mnot.net/blog/2010/04/07/well-known
    87      # https://tools.ietf.org/html/rfc5785
    88      location ~* /\.(?!well-known\/) {
    89          deny all;
    90      }
    91  
    92      # Prevent clients from accessing to backup/config/source files
    93      location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
    94          deny all;
    95      }
    96  
    97      ## Regular private file serving (i.e. handled by Drupal).
    98      location ^~ /system/files/ {
    99          ## For not signaling a 404 in the error log whenever the
   100          ## system/files directory is accessed add the line below.
   101          ## Note that the 404 is the intended behavior.
   102          log_not_found off;
   103          access_log off;
   104          expires 30d;
   105          try_files $uri @rewrite;
   106      }
   107      include /etc/nginx/common.d/*.conf;
   108      include /mnt/ddev_config/nginx/*.conf;
   109  }