Skip to content

Instantly share code, notes, and snippets.

@boywhoroared
Forked from cbmd/default.conf
Last active August 29, 2015 14:14
Show Gist options
  • Save boywhoroared/1172b8ef60b4d218898a to your computer and use it in GitHub Desktop.
Save boywhoroared/1172b8ef60b4d218898a to your computer and use it in GitHub Desktop.
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
set $servername "${domain}.dev";
}
if ($domain ~ "^(.*)\.(.[^.]*)\.dev$") {
set $subdomain $1;
set $domain $2;
set $rootpath "${domain}/${subdomain}/www/";
set $servername "${subdomain}.${domain}.dev";
}
server_name $servername;
root $basepath/$rootpath;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location ~ /\.git {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment