Skip to content

Instantly share code, notes, and snippets.

@jurchiks
Last active January 12, 2016 18:02
Show Gist options
  • Save jurchiks/99b7cb4529d501cc43e8 to your computer and use it in GitHub Desktop.
Save jurchiks/99b7cb4529d501cc43e8 to your computer and use it in GitHub Desktop.
Nginx config for multiple hosts, multi-user, multi-project
server {
listen 80;
server_name ~^(?<project>.+)\.(?<username>.+)\.hhvm\.dyninno\.net$;
if (!-d /home/$username/public_html/$project) {
return 405;
break;
}
set $root /home/$username/public_html/$project;
# if public/index.php exists, assume that is the index file
# modern PHP frameworks have document root in /public subfolder
if (-f $root/public/index.php) {
set $root $root/public;
}
root $root;
access_log /var/log/nginx/hhvm.dyninno.net-access.log;
error_log /var/log/nginx/hhvm.dyninno.net-error.log info;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.(svn|git|hg|bzr|cvs|ht) { deny all; }
location ~ /(favicon.ico|robots.txt) { log_not_found off; access_log off; }
#include php7.conf;
include hhvm.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment