iserver { listen 80; server_name www.example.com; return 301 $scheme://example.com$request_uri; } server { listen 80; server_name example.com; index index.php; # Replace the path with the actual path to WordPress core files root /home/username/sites/example.com/public; access_log /var/log/nginx/example.com-access.log combined buffer=64k flush=5m if=$loggable; error_log /var/log/nginx/example.com-error.log; include "globals/assets.conf"; include "globals/restrictions.conf"; # Add trailing slash to */wp-admin requests. rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~ \.php$ { proxy_pass http://apache; include proxy_params; } location @backend { proxy_pass http://varnish; include proxy_params; } location / { try_files $uri @backend; } }