Created
February 9, 2016 14:36
-
-
Save vl-ivanov/43536495c1990b834d00 to your computer and use it in GitHub Desktop.
Wildcard nginx config. It handles all <something>.dev.raspberry.pw domains
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 { | |
| 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