Created
March 11, 2012 21:20
-
-
Save nlenepveu/2018246 to your computer and use it in GitHub Desktop.
Mass virtual hosts with Nginx for Zend Framework applications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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