devilbox/.devilbox/etc/nginx-stable/01-vhost-default.conf
2017-05-16 20:44:59 +02:00

76 lines
1.5 KiB
Plaintext

##
## Default Host for http://localhost
##
server {
listen 80 default_server;
server_name _;
server_name localhost;
server_name 127.0.0.1;
server_name httpd;
server_name 172.16.238.*;
# Root directive
root /var/www/default/htdocs;
index index.php;
access_log /var/log/nginx-stable/devilbox-access.log main;
error_log /var/log/nginx-stable/devilbox-error.log warn;
# Devilbox httpd info/status
location /devilbox-httpd-status {
stub_status on;
access_log off;
}
# Devilbox API endpoint
location ~ /devilbox-api/ {
root /var/www/default/api/;
index status.json;
# 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";
}
}
# Front-controller pattern as recommended by the nginx docs
location / {
try_files $uri $uri/ /index.php;
}
# PHP FPM
location ~ \.php?$ {
# 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)(.*)$;
#### FPM Server
fastcgi_pass php:9000;
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;
}
}