Skip to content

Instantly share code, notes, and snippets.

@erikwiffin
Created April 14, 2013 02:07
Show Gist options
  • Save erikwiffin/5381059 to your computer and use it in GitHub Desktop.
Save erikwiffin/5381059 to your computer and use it in GitHub Desktop.
nginx.conf
server {
## Your website name goes here.
server_name erik.wiffin.com;
## Your only path reference.
root /var/www/erik.wiffin.com/;
listen 8080;
## This should be in your http block and if it is, it's not needed here.
index index.html index.htm index.php;
include conf.d/drop;
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/dev/shm/php-fpm-www.sock;
}
# Tell the browser to cache all images for 3 weeks
location ~* \.(gif|png|ico|jpe?g)$ {
expires 3w;
access_log off;
}
# Tell the browser to cache all CSS and JS for 1 week
location ~* \.(css|js)$ {
expires 1w;
access_log off;
}
## Turn gzip on
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment