Skip to content

Instantly share code, notes, and snippets.

@vl-ivanov
Created February 9, 2016 14:36
Show Gist options
  • Select an option

  • Save vl-ivanov/43536495c1990b834d00 to your computer and use it in GitHub Desktop.

Select an option

Save vl-ivanov/43536495c1990b834d00 to your computer and use it in GitHub Desktop.
Wildcard nginx config. It handles all <something>.dev.raspberry.pw domains
server {
listen 80;
server_name "~^(?<sub>.+)\.dev\.raspberry\.pw$";
if ($sub = "") {
set $sub "raspberry.pw";
}
index index.html index.htm index.php;
root /var/www/$sub/htdocs;
location / {
satisfy any;
allow 192.168.1.1;
deny all;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SERVER_NAME $http_host;
fastcgi_param APPLICATION_ENV dev;
}
error_log /var/log/nginx/error.log error;
access_log /var/log/nginx/${sub}_access.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment