65 lines
2.5 KiB
Text
65 lines
2.5 KiB
Text
# The primary template file for WordPress sites
|
|
# Feel free to follow the same pattern for other files in the /sites-available/ directory
|
|
# Remember to create a symlink to /sites-enabled/ to enable a site or configuration file
|
|
|
|
### server-level 301 redirect
|
|
# you are a fan of micro-optimization, please use the following to redirect www.example.com => example.com (301)
|
|
# server {
|
|
# listen 80;
|
|
# listen [::]:80; # IPv6 support
|
|
# server_name www.example.com;
|
|
# return 301 $scheme://example.com$request_uri;
|
|
# }
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80; # IPv6 support
|
|
server_name example.com;
|
|
|
|
server_name www.example.com; # hide this line, if you enable the server-level 301 redirect above
|
|
|
|
index index.php; # default file to serve
|
|
|
|
# Replace the path with the actual path to WordPress core files
|
|
root /home/username/sites/example.com/public;
|
|
|
|
### Logs
|
|
access_log /var/log/nginx/example.com-access.log;
|
|
# if the log files become too large, you may use the following format. $loggable is defined in conf.d/common.conf
|
|
# access_log /var/log/nginx/example.com-access.log combined buffer=64k flush=5m if=$loggable;
|
|
|
|
# ideally use it along with fail2ban
|
|
error_log /var/log/nginx/example.com-error.log;
|
|
# use the following pattern only for debugging - server support needed
|
|
# error_log /var/log/nginx/example.com-error.log debug;
|
|
|
|
# Optional configurations
|
|
# include "globals/auto-versioning-support.conf";
|
|
# include "globals/wordpress-seo-plugin-support.conf";
|
|
|
|
include "globals/restrictions.conf";
|
|
include "globals/assets.conf";
|
|
|
|
location ~* \.php$ {
|
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
|
if (!-f $document_root$fastcgi_script_name) { return 404; }
|
|
|
|
# Mitigate https://httpoxy.org/ vulnerabilities
|
|
fastcgi_param HTTP_PROXY "";
|
|
|
|
include "fastcgi_params";
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
fastcgi_index index.php;
|
|
fastcgi_pass fpm;
|
|
|
|
add_header "X-Cache" "MISS";
|
|
}
|
|
|
|
### Enaable only one of the following lines
|
|
include "globals/wp-super-cache.conf"; # WP Super Cache plugin support
|
|
# include "globals/wp-rocket.conf"; # WP Rocket Cache plugin support
|
|
# include "globals/wp-fastest-cache.conf"; # WP Fastest Cache plugin support
|
|
# include "globals/cache-enabler.conf"; # Cache Enabler plugin support
|
|
# location / { try_files $uri $uri/ /index.php$is_args$args; } # the plain-old method - suits Batcache
|
|
|
|
}
|