The point
The whole point of this is to get as much load off of Apache as possible to keep the server running nice and smoothly.
Configuration
The configuration below will mean that nginx will serve basically everything;
- static files
- uploaded files and
- cached content
simply replace the VARIABLES below and everything should be good to go, if copy-pasting from below isn’t working properly you can download a full copy from here.
server {
listen 80;
server_name **DOMAIN_HERE**;
access_log /var/log/nginx/access.**DOMAIN_HERE**.log;
gzip on;
gzip_disable msie6; # disable gzip for IE6
gzip_static on;
gzip_comp_level 9; # highest level of compression
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;root **/PATH/TO/WORDPRESS**;
# default location, used for the basic proxying
location / {
# if we're requesting a file and …