Nginx Proxy WordPress Configuration

If you need to proxy your WordPress blog via Nginx. This is the configuration I have recently used.

Update <server-name> with your intended domain name. <ip-address> and <port> with the WordPress servers details.

server {
        server_name <server-name>;

        gzip on;
        gzip_min_length 10240;
        gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
        gzip_disable "MSIE [1-6]\.";

        add_header Cache-Control public;

        location / {
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header Host $host;
                proxy_pass http://<ip-address>:<port>;
        }
}

Leave a Reply