Skip to content

Instantly share code, notes, and snippets.

@jeffbeard
Created September 5, 2011 15:48
Show Gist options
  • Save jeffbeard/1195298 to your computer and use it in GitHub Desktop.
Save jeffbeard/1195298 to your computer and use it in GitHub Desktop.
nginx virtual host file
server {
listen 8080;
server_name foo.com www.foo.com;
root /var/www;
index index.php;
access_log /var/log/nginx/foo.access.log;
error_log /var/log/nginx/foo.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
## Parse all .php file in the /var/www directory
location ~ .php$ {
try_files $uri = 404;
fastcgi_index index.php;
fastcgi_pass backend;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
# BEGIN W3TC Browser Cache
gzip on;
gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location ~ \.(css|js|htc)$ {
add_header X-Powered-By "W3 Total Cache/0.9.2.4";
}
location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
add_header X-Powered-By "W3 Total Cache/0.9.2.4";
}
location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|t
add_header X-Powered-By "W3 Total Cache/0.9.2.4";
}
# END W3TC Browser Cache
# BEGIN W3TC Minify core
rewrite ^/wp-content/w3tc/min/w3tc_rewrite_test$ /wp-content/w3tc/min/index.php?w3tc_rewrite_test=1 last;
rewrite ^/wp-content/w3tc/min/(.+\.(css|js))$ /wp-content/w3tc/min/index.php?file=$1 last;
# END W3TC Minify core
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment