Skip to content

Instantly share code, notes, and snippets.

@nlenepveu
Created March 11, 2012 21:20
Show Gist options
  • Save nlenepveu/2018246 to your computer and use it in GitHub Desktop.
Save nlenepveu/2018246 to your computer and use it in GitHub Desktop.
Mass virtual hosts with Nginx for Zend Framework applications
server {
# Make sites accessible from http://$sub.localhost/
server_name ~^(?P<sub>.+)\.localhost$;
root /var/www/vhosts/$sub/public;
location ~* ^.+.(css|js|jpeg|jpg|gif|png|ico) {
expires 30d;
}
location / {
# First attempt to serve request as
# file, then fall back to index.php
try_files $uri /index.php?$args;
}
# pass the PHP scripts to FastCGI server
#
location ~ \.php$ {
fastcgi_pass unix:/usr/local/var/run/php-fpm.socket;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment