user nginx; worker_processes auto; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 2; server { listen 80; # REPLACE domain.tld or use catch all _; server_name *.domain.tld; location / { try_files $uri $uri/ /index.php?q=$uri&$args; root /usr/local/nginx/html; index index.html index.php; } location ~*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|cur)$ { expires max; log_not_found off; access_log off; } location /xmlrpc.php { deny all; } location ~* wp-config.php { deny all; } location ~* /wp-includes/.*.php$ { deny all; access_log off; log_not_found off; } location ~* /wp-content/.*.php$ { deny all; access_log off; log_not_found off; } # pagespeed stuff pagespeed on; pagespeed ModifyCachingHeaders on; pagespeed FileCachePath /var/ngx_pagespeed_cache; location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; } location ~ "^/pagespeed_static/" { } location ~ "^/ngx_pagespeed_beacon$" { } #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_param HTTP_PROXY ""; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } }