mirror of
https://github.com/cytopia/devilbox.git
synced 2025-05-05 02:03:20 +00:00
Adding vhost-gen templates
This commit is contained in:
parent
2c69626a1d
commit
ed2d12dbba
146
templates/vhost-gen/apache22.yml
Normal file
146
templates/vhost-gen/apache22.yml
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
# Apache 2.2 vHost Template defintion for vhost-gen.py
|
||||||
|
#
|
||||||
|
# The 'feature' section contains optional features that can be enabled via
|
||||||
|
# conf.yml and will then be replaced into the main vhost ('structure' section)
|
||||||
|
# into their corresponding position:
|
||||||
|
#
|
||||||
|
# __XDOMAIN_REQ__
|
||||||
|
# __PHP_FPM__
|
||||||
|
# __ALIASES__
|
||||||
|
# __DENIES__
|
||||||
|
# __STATUS__
|
||||||
|
#
|
||||||
|
# The features itself also contain variables to be adjusted in conf.yml
|
||||||
|
# and will then be replaced in their corresponding feature section
|
||||||
|
# before being replaced into the vhost section (if enabled):
|
||||||
|
#
|
||||||
|
# PHP-FPM:
|
||||||
|
# __PHP_ADDR__
|
||||||
|
# __PHP_PORT__
|
||||||
|
# XDomain:
|
||||||
|
# __REGEX__
|
||||||
|
# Alias:
|
||||||
|
# __REGEX__
|
||||||
|
# __PATH__
|
||||||
|
# Deny:
|
||||||
|
# __REGEX__
|
||||||
|
# Status:
|
||||||
|
# __REGEX__
|
||||||
|
#
|
||||||
|
# Variables to be replaced directly in the vhost configuration can also be set
|
||||||
|
# in conf.yml and include:
|
||||||
|
# __VHOST_NAME__
|
||||||
|
# __DOCUMENT_ROOT__
|
||||||
|
# __INDEX__
|
||||||
|
# __ACCESS_LOG__
|
||||||
|
# __ERROR_LOG__
|
||||||
|
# __PHP_ADDR__
|
||||||
|
# __PHP_PORT__
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Basic vHost skeleton
|
||||||
|
###
|
||||||
|
vhost: |
|
||||||
|
<VirtualHost __DEFAULT_VHOST__:__PORT__>
|
||||||
|
ServerName __VHOST_NAME__
|
||||||
|
|
||||||
|
CustomLog "__ACCESS_LOG__" combined
|
||||||
|
ErrorLog "__ERROR_LOG__"
|
||||||
|
|
||||||
|
__VHOST_DOCROOT__
|
||||||
|
__VHOST_RPROXY__
|
||||||
|
__PHP_FPM__
|
||||||
|
__ALIASES__
|
||||||
|
__DENIES__
|
||||||
|
__SERVER_STATUS__
|
||||||
|
# Custom directives
|
||||||
|
__CUSTOM__
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
###
|
||||||
|
### vHost Type (normal or reverse proxy)
|
||||||
|
###
|
||||||
|
vhost_type:
|
||||||
|
# Normal vHost (-p)
|
||||||
|
docroot: |
|
||||||
|
# Define the vhost to serve files
|
||||||
|
DocumentRoot "__DOCUMENT_ROOT__"
|
||||||
|
<Directory "__DOCUMENT_ROOT__">
|
||||||
|
DirectoryIndex __INDEX__
|
||||||
|
|
||||||
|
AllowOverride All
|
||||||
|
Options All
|
||||||
|
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteBase /
|
||||||
|
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
# Reverse Proxy (-r)
|
||||||
|
rproxy: |
|
||||||
|
# Define the vhost to reverse proxy
|
||||||
|
ProxyRequests off
|
||||||
|
ProxyPass __LOCATION__ __PROXY_PROTO://__PROXY_ADDR__:__PROXY_PORT__
|
||||||
|
ProxyHTMLURLMap __PROXY_PROTO://__PROXY_ADDR__:__PROXY_PORT__ __LOCATION__
|
||||||
|
<location __LOCATION__>
|
||||||
|
ProxyPassReverse /
|
||||||
|
SetOutputFilter proxy-html
|
||||||
|
ProxyHTMLURLMap / __LOCATION__
|
||||||
|
ProxyHTMLURLMap __LOCATION__ __LOCATION__
|
||||||
|
RequestHeader unset Accept-Encoding
|
||||||
|
</location>
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Optional features to be enabled in vHost
|
||||||
|
###
|
||||||
|
features:
|
||||||
|
|
||||||
|
# PHP-FPM will not be applied to a reverse proxy!
|
||||||
|
php_fpm: |
|
||||||
|
# PHP-FPM Definition
|
||||||
|
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://__PHP_ADDR__:__PHP_PORT____DOCUMENT_ROOT__/$1
|
||||||
|
|
||||||
|
alias: |
|
||||||
|
# Alias Definition
|
||||||
|
Alias "__ALIAS__" "__PATH____ALIAS__"
|
||||||
|
<Location "__ALIAS__">
|
||||||
|
__XDOMAIN_REQ__
|
||||||
|
</Location>
|
||||||
|
<Directory "__PATH____ALIAS__">
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
deny: |
|
||||||
|
# Deny Definition
|
||||||
|
<FilesMatch "__REGEX__">
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
server_status: |
|
||||||
|
# Status Page
|
||||||
|
<Location __REGEX__>
|
||||||
|
SetHandler server-status
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</Location>
|
||||||
|
|
||||||
|
xdomain_request: |
|
||||||
|
# Allow cross domain request from these hosts
|
||||||
|
SetEnvIf Origin "__REGEX__" AccessControlAllowOrigin=$0$1
|
||||||
|
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
|
||||||
|
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
|
||||||
|
Header always set Access-Control-Max-Age "0"
|
||||||
|
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
|
||||||
|
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_METHOD} OPTIONS
|
||||||
|
RewriteRule ^(.*)$ $1 [R=200,L]
|
163
templates/vhost-gen/apache24.yml
Normal file
163
templates/vhost-gen/apache24.yml
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
# Apache 2.4 vHost Template defintion for vhost-gen.py
|
||||||
|
#
|
||||||
|
# The 'feature' section contains optional features that can be enabled via
|
||||||
|
# conf.yml and will then be replaced into the main vhost ('structure' section)
|
||||||
|
# into their corresponding position:
|
||||||
|
#
|
||||||
|
# __XDOMAIN_REQ__
|
||||||
|
# __PHP_FPM__
|
||||||
|
# __ALIASES__
|
||||||
|
# __DENIES__
|
||||||
|
# __STATUS__
|
||||||
|
#
|
||||||
|
# The features itself also contain variables to be adjusted in conf.yml
|
||||||
|
# and will then be replaced in their corresponding feature section
|
||||||
|
# before being replaced into the vhost section (if enabled):
|
||||||
|
#
|
||||||
|
# PHP-FPM:
|
||||||
|
# __PHP_ADDR__
|
||||||
|
# __PHP_PORT__
|
||||||
|
# XDomain:
|
||||||
|
# __REGEX__
|
||||||
|
# Alias:
|
||||||
|
# __REGEX__
|
||||||
|
# __PATH__
|
||||||
|
# Deny:
|
||||||
|
# __REGEX__
|
||||||
|
# Status:
|
||||||
|
# __REGEX__
|
||||||
|
#
|
||||||
|
# Variables to be replaced directly in the vhost configuration can also be set
|
||||||
|
# in conf.yml and include:
|
||||||
|
# __VHOST_NAME__
|
||||||
|
# __DOCUMENT_ROOT__
|
||||||
|
# __INDEX__
|
||||||
|
# __ACCESS_LOG__
|
||||||
|
# __ERROR_LOG__
|
||||||
|
# __PHP_ADDR__
|
||||||
|
# __PHP_PORT__
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Basic vHost skeleton
|
||||||
|
###
|
||||||
|
vhost: |
|
||||||
|
<VirtualHost __DEFAULT_VHOST__:__PORT__>
|
||||||
|
ServerName __VHOST_NAME__
|
||||||
|
|
||||||
|
CustomLog "__ACCESS_LOG__" combined
|
||||||
|
ErrorLog "__ERROR_LOG__"
|
||||||
|
|
||||||
|
__VHOST_DOCROOT__
|
||||||
|
__VHOST_RPROXY__
|
||||||
|
__PHP_FPM__
|
||||||
|
__ALIASES__
|
||||||
|
__DENIES__
|
||||||
|
__SERVER_STATUS__
|
||||||
|
# Custom directives
|
||||||
|
__CUSTOM__
|
||||||
|
</VirtualHost>
|
||||||
|
|
||||||
|
###
|
||||||
|
### vHost Type (normal or reverse proxy)
|
||||||
|
###
|
||||||
|
vhost_type:
|
||||||
|
# Normal vHost (-p)
|
||||||
|
docroot: |
|
||||||
|
# Define the vhost to serve files
|
||||||
|
DocumentRoot "__DOCUMENT_ROOT__"
|
||||||
|
<Directory "__DOCUMENT_ROOT__">
|
||||||
|
DirectoryIndex __INDEX__
|
||||||
|
|
||||||
|
AllowOverride All
|
||||||
|
Options All
|
||||||
|
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteBase /
|
||||||
|
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
# Reverse Proxy (-r)
|
||||||
|
rproxy: |
|
||||||
|
# Define the vhost to reverse proxy
|
||||||
|
ProxyRequests off
|
||||||
|
ProxyPass __LOCATION__ __PROXY_PROTO://__PROXY_ADDR__:__PROXY_PORT__
|
||||||
|
ProxyHTMLURLMap __PROXY_PROTO://__PROXY_ADDR__:__PROXY_PORT__ __LOCATION__
|
||||||
|
<location __LOCATION__>
|
||||||
|
ProxyPassReverse /
|
||||||
|
SetOutputFilter proxy-html
|
||||||
|
ProxyHTMLURLMap / __LOCATION__
|
||||||
|
ProxyHTMLURLMap __LOCATION__ __LOCATION__
|
||||||
|
RequestHeader unset Accept-Encoding
|
||||||
|
</location>
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Optional features to be enabled in vHost
|
||||||
|
###
|
||||||
|
features:
|
||||||
|
|
||||||
|
# PHP-FPM will not be applied to a reverse proxy!
|
||||||
|
php_fpm: |
|
||||||
|
# PHP-FPM Definition
|
||||||
|
<FilesMatch \.php$>
|
||||||
|
Require all granted
|
||||||
|
SetHandler proxy:fcgi://__PHP_ADDR__:__PHP_PORT__
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
# enablereuse requires Apache 2.4.11 or later
|
||||||
|
<Proxy "fcgi://__PHP_ADDR__:__PHP_PORT__/" enablereuse=on max=10>
|
||||||
|
</Proxy>
|
||||||
|
|
||||||
|
# If the php file doesn't exist, disable the proxy handler.
|
||||||
|
# This will allow .htaccess rewrite rules to work and
|
||||||
|
# the client will see the default 404 page of Apache
|
||||||
|
RewriteCond %{REQUEST_FILENAME} \.php$
|
||||||
|
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
|
||||||
|
RewriteRule (.*) - [H=text/html]
|
||||||
|
|
||||||
|
alias: |
|
||||||
|
# Alias Definition
|
||||||
|
Alias "__ALIAS__" "__PATH____ALIAS__"
|
||||||
|
<Location "__ALIAS__">
|
||||||
|
__XDOMAIN_REQ__
|
||||||
|
</Location>
|
||||||
|
<Directory "__PATH____ALIAS__">
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
deny: |
|
||||||
|
# Deny Definition
|
||||||
|
<FilesMatch "__REGEX__">
|
||||||
|
Order allow,deny
|
||||||
|
Deny from all
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
server_status: |
|
||||||
|
# Status Page
|
||||||
|
<Location __REGEX__>
|
||||||
|
SetHandler server-status
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
Require all granted
|
||||||
|
</Location>
|
||||||
|
|
||||||
|
xdomain_request: |
|
||||||
|
# Allow cross domain request from these hosts
|
||||||
|
SetEnvIf Origin "__REGEX__" AccessControlAllowOrigin=$0$1
|
||||||
|
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
|
||||||
|
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
|
||||||
|
Header always set Access-Control-Max-Age "0"
|
||||||
|
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
|
||||||
|
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_METHOD} OPTIONS
|
||||||
|
RewriteRule ^(.*)$ $1 [R=200,L]
|
139
templates/vhost-gen/nginx.yml
Normal file
139
templates/vhost-gen/nginx.yml
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
# Nginx vHost Template defintion for vhost-gen.py
|
||||||
|
#
|
||||||
|
# The 'feature' section contains optional features that can be enabled via
|
||||||
|
# conf.yml and will then be replaced into the main vhost ('structure' section)
|
||||||
|
# into their corresponding position:
|
||||||
|
#
|
||||||
|
# __XDOMAIN_REQ__
|
||||||
|
# __PHP_FPM__
|
||||||
|
# __ALIASES__
|
||||||
|
# __DENIES__
|
||||||
|
# __STATUS__
|
||||||
|
#
|
||||||
|
# The features itself also contain variables to be adjusted in conf.yml
|
||||||
|
# and will then be replaced in their corresponding feature section
|
||||||
|
# before being replaced into the vhost section (if enabled):
|
||||||
|
#
|
||||||
|
# PHP-FPM:
|
||||||
|
# __PHP_ADDR__
|
||||||
|
# __PHP_PORT__
|
||||||
|
# XDomain:
|
||||||
|
# __REGEX__
|
||||||
|
# Alias:
|
||||||
|
# __REGEX__
|
||||||
|
# __PATH__
|
||||||
|
# Deny:
|
||||||
|
# __REGEX__
|
||||||
|
# Status:
|
||||||
|
# __REGEX__
|
||||||
|
#
|
||||||
|
# Variables to be replaced directly in the vhost configuration can also be set
|
||||||
|
# in conf.yml and include:
|
||||||
|
# __VHOST_NAME__
|
||||||
|
# __DOCUMENT_ROOT__
|
||||||
|
# __INDEX__
|
||||||
|
# __ACCESS_LOG__
|
||||||
|
# __ERROR_LOG__
|
||||||
|
# __PHP_ADDR__
|
||||||
|
# __PHP_PORT__
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Basic vHost skeleton
|
||||||
|
###
|
||||||
|
vhost: |
|
||||||
|
server {
|
||||||
|
listen __PORT____DEFAULT_VHOST__;
|
||||||
|
server_name __VHOST_NAME__;
|
||||||
|
|
||||||
|
access_log "__ACCESS_LOG__" combined;
|
||||||
|
error_log "__ERROR_LOG__" warn;
|
||||||
|
|
||||||
|
__VHOST_DOCROOT__
|
||||||
|
__VHOST_RPROXY__
|
||||||
|
__PHP_FPM__
|
||||||
|
__ALIASES__
|
||||||
|
__DENIES__
|
||||||
|
__SERVER_STATUS__
|
||||||
|
# Custom directives
|
||||||
|
__CUSTOM__
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### vHost Type (normal or reverse proxy)
|
||||||
|
###
|
||||||
|
vhost_type:
|
||||||
|
# Normal vHost (-p)
|
||||||
|
docroot: |
|
||||||
|
# Define the vhost to serve files
|
||||||
|
root "__DOCUMENT_ROOT__";
|
||||||
|
index __INDEX__;
|
||||||
|
|
||||||
|
# Reverse Proxy (-r)
|
||||||
|
rproxy: |
|
||||||
|
# Define the vhost to reverse proxy
|
||||||
|
location __LOCATION__ {
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_pass __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Optional features to be enabled in vHost
|
||||||
|
###
|
||||||
|
features:
|
||||||
|
|
||||||
|
# PHP-FPM will not be applied to a reverse proxy!
|
||||||
|
php_fpm: |
|
||||||
|
# PHP-FPM Definition
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
location ~ \.php?$ {
|
||||||
|
try_files $uri = 404;
|
||||||
|
include fastcgi_params;
|
||||||
|
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||||
|
|
||||||
|
fastcgi_pass __PHP_ADDR__:__PHP_PORT__;
|
||||||
|
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
}
|
||||||
|
|
||||||
|
alias: |
|
||||||
|
# Alias Definition
|
||||||
|
location ~ __ALIAS__ {
|
||||||
|
root __PATH__;
|
||||||
|
__XDOMAIN_REQ__
|
||||||
|
}
|
||||||
|
|
||||||
|
deny: |
|
||||||
|
# Deny Definition
|
||||||
|
location ~ __REGEX__ {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
server_status: |
|
||||||
|
# Status Page
|
||||||
|
location ~ __REGEX__ {
|
||||||
|
stub_status on;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
xdomain_request: |
|
||||||
|
# Allow cross domain request from these hosts
|
||||||
|
if ( $http_origin ~* (__REGEX__) ) {
|
||||||
|
add_header "Access-Control-Allow-Origin" "$http_origin";
|
||||||
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||||
|
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
|
||||||
|
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
|
||||||
|
add_header 'Access-Control-Max-Age' 0;
|
||||||
|
return 200;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user