Skip to content

Instantly share code, notes, and snippets.

@rubensayshi
Created September 18, 2012 11:58
Show Gist options
  • Save rubensayshi/3742757 to your computer and use it in GitHub Desktop.
Save rubensayshi/3742757 to your computer and use it in GitHub Desktop.
Nginx Config
server {
listen 80;
server_name gw2spidy.rubensayshi.com gw2spidy.com;
rewrite ^(.*) http://www.gw2spidy.com$1 permanent;
}
server {
listen 80;
server_name www.gw2spidy.com;
access_log /var/log/nginx/gw2spidy.rubensayshi.com.access.log;
error_log /var/log/nginx/gw2spidy.rubensayshi.com.error.log;
client_max_body_size 4M;
client_body_buffer_size 128k;
expires 24h;
root /var/sandbox/gw2spidy/webroot;
location ~ ^/assets/.* {
expires max;
access_log off;
location ~ ^/assets/v[^/]+/.+ {
rewrite ^/assets/v[^/]+/(.+) /assets/$1 break;
}
}
location / {
index index.php;
# if file exists return it right away
if (-f $request_filename) {
break;
}
if (-e $request_filename) {
break;
}
# Useful rewrite for most frameworks, wordpress
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php last;
break;
}
}
location ~ \.php$ {
expires off;
include /etc/nginx/fastcgi_params;
fastcgi_pass php5-fpm-sock;
if ($request_uri ~ ^/api) {
fastcgi_pass php5-fpm-gw2spidy-api-sock;
}
fastcgi_index index.php;
fastcgi_param PHP_VALUE newrelic.appname="GW2Spidy";
fastcgi_param SCRIPT_FILENAME /var/sandbox/gw2spidy/webroot/$fastcgi_script_name;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment