Skip to content

Instantly share code, notes, and snippets.

@rmrhz
Created June 15, 2016 03:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmrhz/ee9b532d35672e9e4f1ee59022531ce3 to your computer and use it in GitHub Desktop.
Save rmrhz/ee9b532d35672e9e4f1ee59022531ce3 to your computer and use it in GitHub Desktop.
Wildcard subdomain + directory Nginx setup
server {
listen 80;
server_name ~^(?<subdomain>.*)\.labs.dev$;
root "/srv/labs/$subdomain/public";
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment