Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Redis-cached WordPress Nginx configuration file.
server {
listen 80;
server_name XX.XX.XX.XX;
root /var/www/html/default;
location /index.php {
alias /var/www/html/default/wp-index-redis.php;
location / {
index wp-index-redis.php;
try_files $uri $uri/ /wp-index-redis.php?$args;
location /wp-admin/ {
index index.php;
try_files $uri $uri/ /index.php$args;
# Add trailing slash to /wp-admin requests
rewrite /wp-admin$ $scheme::/$host$uri/ permanent;
gzip off;
# Directives to send expires headers and turn off 404 error logging.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
# this prevents hidden files (beginning with a period) from being served
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~ \.php$ {
client_max_body_size 25M;
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.