# ddev wordpress config # https://developer.wordpress.org/advanced-administration/server/web-server/nginx/ #ddev-generated # If you want to take over this file and customize it, remove the line above # and ddev will respect it and won't overwrite the file. # See https://docs.ddev.com/en/stable/users/extend/customization-extendibility/#custom-nginx-configuration # Much of this config is adapted from # https://codex.wordpress.org/Nginx server { listen 80 default_server; listen 443 ssl default_server; root /var/www/html/web; ssl_certificate /etc/ssl/certs/master.crt; ssl_certificate_key /etc/ssl/certs/master.key; include /etc/nginx/monitoring.conf; index index.php index.htm index.html; # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html sendfile off; error_log /dev/stdout info; access_log /var/log/nginx/access.log; # From wordpress demo global_restrictions.conf # Global restrictions configuration file. # Designed to be included in any server {} block. location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban) location ~ /\. { deny all; } # Deny access to any files with a .php extension in the uploads directory # Works in sub-directory installs and also in multisite network # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban) location ~* /(?:uploads|files)/.*\.php$ { deny all; } location / { absolute_redirect off; # This is cool because no php is touched for static content. # include the "?$args" part so non-default permalinks doesn't break when using query string try_files $uri $uri/ /index.php?$args; } # pass the PHP scripts to FastCGI server listening on socket location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php-fpm.sock; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; fastcgi_intercept_errors off; # fastcgi_read_timeout should match max_execution_time in php.ini fastcgi_read_timeout 10m; fastcgi_param SERVER_NAME $host; fastcgi_param HTTPS $fcgi_https; # Pass the X-Accel-* headers to facilitate testing. fastcgi_pass_header "X-Accel-Buffering"; fastcgi_pass_header "X-Accel-Charset"; fastcgi_pass_header "X-Accel-Expires"; fastcgi_pass_header "X-Accel-Limit-Rate"; fastcgi_pass_header "X-Accel-Redirect"; } # Expire rules for static content # Media: images, icons, video, audio, HTC location ~* \.(jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ { expires max; log_not_found off; try_files $uri /index.php$is_args$args; } location ~* \.(js|css)$ { expires -1; log_not_found off; } include /etc/nginx/common.d/*.conf; include /mnt/ddev_config/nginx/*.conf; }