devilbox/.devilbox/etc/nginx-stable/02-vhost-mass.conf

68 lines
1.4 KiB
Plaintext
Raw Normal View History

2016-10-17 02:05:30 +00:00
##
## Default Mass Virtual Host
##
server {
listen 80;
server_name ~^(?<domain>.+)\.[a-zA-Z]+$;
2016-10-17 02:05:30 +00:00
# Root directive
root /shared/httpd/$domain/htdocs/;
index index.php;
access_log /var/log/nginx-stable/projects-access.log main;
error_log /var/log/nginx-stable/projects-error.log warn;
2016-10-17 02:05:30 +00:00
# Devilbox API endpoint
location ~ /devilbox-api/ {
root /var/www/default/api/;
index status.json;
2017-05-16 14:59:21 +00:00
access_log off;
# Allow cross-domain requests to this domain
# Used to validate if client DNS is setup correctly
if ( $http_origin ~* (https?://(localhost|127\.0\.0\.1|httpd)$) ) {
add_header "Access-Control-Allow-Origin" "$http_origin";
}
}
2017-05-16 14:59:21 +00:00
# Front-controller pattern as recommended by the nginx docs
location / {
try_files $uri $uri/ /index.php$is_args$args;
2017-05-16 14:59:21 +00:00
}
# PHP FPM
location ~ \.php?$ {
2016-10-17 02:05:30 +00:00
# PHP.INI:
# ---------------------------
# // Find this:
# cgi.fix_pathinfo=1
# // Replace with:
# cgi.fix_pathinfo=0
try_files $uri = 404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$;
#### SOCKET
fastcgi_pass php:9000;
2016-10-17 02:05:30 +00:00
fastcgi_index index.php;
fastcgi_intercept_errors on;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
# disallow access to git configs path
location ~ /\.git {
deny all;
}
}