Skip to content

Instantly share code, notes, and snippets.

@haswalt
Created March 5, 2011 13:03
Show Gist options
  • Save haswalt/856340 to your computer and use it in GitHub Desktop.
Save haswalt/856340 to your computer and use it in GitHub Desktop.
nginx config for loading generic php and html websites running php-fpm using wildcard vhosts. "webdev" is the suffix for hosts so to get to the site for example you would use http://example.webdev/
server {
server_name .webdev;
index index.html index.php;
autoindex on;
set $root "";
if ($host ~* ^(www\.)?(.+)\.webdev) {
set $root $2;
}
location / {
root /Users/harry/Sites/$root/;
}
location ~ \.php$ {
set $script $uri;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /Users/harry/Sites/$root$script;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment