Skip to content

Instantly share code, notes, and snippets.

@pepijnblom
Created May 3, 2016 05:30
Show Gist options
  • Save pepijnblom/9b403f9d2a3e9e3e659eaf65b1eed733 to your computer and use it in GitHub Desktop.
Save pepijnblom/9b403f9d2a3e9e3e659eaf65b1eed733 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name yourdomain.com;
root /var/www/yourdomain;
index index.php;
# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires max;
}
location ~ \.php$ {
root /var/www/yourdomain;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
location ~ /\.ht {
deny all;
}
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?$args;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment