Update vhost-gen templates

This commit is contained in:
cytopia 2022-12-27 02:58:40 +01:00
parent e18e923d87
commit b05f4240f3
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
4 changed files with 116 additions and 34 deletions

View File

@ -34,10 +34,23 @@
# __ERROR_LOG__ # __ERROR_LOG__
# #
###
### Notes about Apache
###
#
# 1. Each same directive is checked in order of definition (last one wins)
# 2. Directives are ordered: Directory, DirectoryMatch, Files, and finally Location (last one wins)
# * Last match always takes precedence
#
# Exception: Directories, where shortest path is matched first
# Exception: ProxyPass and Alias first match and then stops
### ###
### Basic vHost skeleton ### Basic vHost skeleton
### ###
### Note: Reverse Proxy section must be last for Apache 2.2
###
vhost: | vhost: |
<VirtualHost __DEFAULT_VHOST__:__PORT__> <VirtualHost __DEFAULT_VHOST__:__PORT__>
ServerName __VHOST_NAME__ ServerName __VHOST_NAME__
@ -45,11 +58,17 @@ vhost: |
CustomLog "__ACCESS_LOG__" combined CustomLog "__ACCESS_LOG__" combined
ErrorLog "__ERROR_LOG__" ErrorLog "__ERROR_LOG__"
# Reverse Proxy definition (Ensure to adjust the port, currently '8000') # ProxyRequests: Disable "Forward Proxy"
# ProxyPreserveHost: Pass "Host" header to remote
# ProxyVia: Add "Via" header
ProxyRequests Off ProxyRequests Off
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass / http://php:8000/ retry=0 ProxyVia On
ProxyPassReverse / http://php:8000/ <Location />
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
ProxyPass http://php:8000/ retry=0
ProxyPassReverse http://php:8000/
</Location>
__REDIRECT__ __REDIRECT__
__SSL__ __SSL__
@ -102,10 +121,10 @@ features:
deny: | deny: |
# Deny Definition # Deny Definition
<FilesMatch "__REGEX__"> <LocationMatch "__REGEX__">
Order allow,deny Order allow,deny
Deny from all Deny from all
</FilesMatch> </LocationMatch>
server_status: | server_status: |
# Status Page # Status Page

View File

@ -40,10 +40,23 @@
# __PHP_PORT__ # __PHP_PORT__
# #
###
### Notes about Apache
###
#
# 1. Each same directive is checked in order of definition (last one wins)
# 2. Directives are ordered: Directory, DirectoryMatch, Files, and finally Location (last one wins)
# * Last match always takes precedence
#
# Exception: Directories, where shortest path is matched first
# Exception: ProxyPass and Alias first match and then stops
### ###
### Basic vHost skeleton ### Basic vHost skeleton
### ###
### Note: Reverse Proxy section must be last for Apache 2.2
###
vhost: | vhost: |
<VirtualHost __DEFAULT_VHOST__:__PORT__> <VirtualHost __DEFAULT_VHOST__:__PORT__>
ServerName __VHOST_NAME__ ServerName __VHOST_NAME__
@ -57,10 +70,10 @@ vhost: |
__PHP_FPM__ __PHP_FPM__
__ALIASES__ __ALIASES__
__DENIES__ __DENIES__
__VHOST_RPROXY__
__SERVER_STATUS__ __SERVER_STATUS__
# Custom directives # Custom directives
__CUSTOM__ __CUSTOM__
__VHOST_RPROXY__
</VirtualHost> </VirtualHost>
### ###
@ -86,28 +99,36 @@ vhost_type:
# Reverse Proxy (-r http(s)://ADDR:PORT) # Reverse Proxy (-r http(s)://ADDR:PORT)
rproxy: | rproxy: |
# Define Reverse Proxy # ProxyRequests: Disable "Forward Proxy"
# ProxyPreserveHost: Pass "Host" header to remote
# ProxyVia: Add "Via" header
ProxyRequests Off ProxyRequests Off
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass __LOCATION__ __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0 ProxyVia On
ProxyPassReverse __LOCATION__ __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ <Location __LOCATION__>
# Reverse Proxy
ProxyPass __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0
ProxyPassReverse __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/
</Location>
# Reverse Proxy with websocket support (-r ws(s)://ADDR:PORT) # Reverse Proxy with websocket support (-r ws(s)://ADDR:PORT)
rproxy_ws: | rproxy_ws: |
# Define Reverse Proxy with Websock support # ProxyRequests: Disable "Forward Proxy"
# ProxyPreserveHost: Pass "Host" header to remote
# ProxyVia: Add "Via" header
ProxyRequests Off ProxyRequests Off
ProxyPreserveHost On ProxyPreserveHost On
<location __LOCATION__> ProxyVia On
<Location __LOCATION__>
# Websocket Rewrite Settings # Websocket Rewrite Settings
RewriteEngine On RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC] RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule ^/?(.*)$ __WS_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/$1 [P,L] RewriteRule ^/?(.*)$ __WS_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/$1 [P,L]
# Reverse Proxy
# Reverse Proxy Settings
ProxyPass __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0 ProxyPass __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0
ProxyPassReverse __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ ProxyPassReverse __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/
</location> </Location>
### ###
@ -147,10 +168,10 @@ features:
deny: | deny: |
# Deny Definition # Deny Definition
<FilesMatch "__REGEX__"> <LocationMatch "__REGEX__">
Order allow,deny Order allow,deny
Deny from all Deny from all
</FilesMatch> </LocationMatch>
server_status: | server_status: |
# Status Page # Status Page

View File

@ -34,6 +34,17 @@
# __ERROR_LOG__ # __ERROR_LOG__
# #
###
### Notes about Apache
###
#
# 1. Each same directive is checked in order of definition (last one wins)
# 2. Directives are ordered: Directory, DirectoryMatch, Files, and finally Location (last one wins)
# * Last match always takes precedence
#
# Exception: Directories, where shortest path is matched first
# Exception: ProxyPass and Alias first match and then stops
### ###
### Basic vHost skeleton ### Basic vHost skeleton
@ -46,11 +57,19 @@ vhost: |
CustomLog "__ACCESS_LOG__" combined CustomLog "__ACCESS_LOG__" combined
ErrorLog "__ERROR_LOG__" ErrorLog "__ERROR_LOG__"
# Reverse Proxy definition (Ensure to adjust the port, currently '8000') # ProxyRequests: Disable "Forward Proxy"
# ProxyPreserveHost: Pass "Host" header to remote
# ProxyAddHeaders: Add "X-Forward-*" headers
# ProxyVia: Add "Via" header
ProxyRequests Off ProxyRequests Off
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass / http://php:8000/ retry=0 ProxyAddHeaders On
ProxyPassReverse / http://php:8000/ ProxyVia On
<Location />
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
ProxyPass http://php:8000/ retry=0
ProxyPassReverse http://php:8000/
</Location>
__REDIRECT__ __REDIRECT__
__SSL__ __SSL__
@ -104,10 +123,10 @@ features:
deny: | deny: |
# Deny Definition # Deny Definition
<FilesMatch "__REGEX__"> <LocationMatch "__REGEX__">
Order allow,deny Order allow,deny
Deny from all Deny from all
</FilesMatch> </LocationMatch>
server_status: | server_status: |
# Status Page # Status Page

View File

@ -40,6 +40,17 @@
# __PHP_PORT__ # __PHP_PORT__
# #
###
### Notes about Apache
###
#
# 1. Each same directive is checked in order of definition (last one wins)
# 2. Directives are ordered: Directory, DirectoryMatch, Files, and finally Location (last one wins)
# * Last match always takes precedence
#
# Exception: Directories, where shortest path is matched first
# Exception: ProxyPass and Alias first match and then stops
### ###
### Basic vHost skeleton ### Basic vHost skeleton
@ -55,10 +66,10 @@ vhost: |
__REDIRECT__ __REDIRECT__
__SSL__ __SSL__
__VHOST_DOCROOT__ __VHOST_DOCROOT__
__VHOST_RPROXY__
__PHP_FPM__ __PHP_FPM__
__ALIASES__ __ALIASES__
__DENIES__ __DENIES__
__VHOST_RPROXY__
__SERVER_STATUS__ __SERVER_STATUS__
# Custom directives # Custom directives
__CUSTOM__ __CUSTOM__
@ -88,28 +99,40 @@ vhost_type:
# Reverse Proxy (-r http(s)://ADDR:PORT) # Reverse Proxy (-r http(s)://ADDR:PORT)
rproxy: | rproxy: |
# Define Reverse Proxy # ProxyRequests: Disable "Forward Proxy"
# ProxyPreserveHost: Pass "Host" header to remote
# ProxyAddHeaders: Add "X-Forward-*" headers
# ProxyVia: Add "Via" header
ProxyRequests Off ProxyRequests Off
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass __LOCATION__ __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0 ProxyAddHeaders On
ProxyPassReverse __LOCATION__ __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ ProxyVia On
<Location __LOCATION__>
# Reverse Proxy
ProxyPass __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0
ProxyPassReverse __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/
</Location>
# Reverse Proxy with websocket support (-r ws(s)://ADDR:PORT) # Reverse Proxy with websocket support (-r ws(s)://ADDR:PORT)
rproxy_ws: | rproxy_ws: |
# Define Reverse Proxy with Websock support # ProxyRequests: Disable "Forward Proxy"
ProxyRequests Off # ProxyPreserveHost: Pass "Host" header to remote
<location __LOCATION__> # ProxyAddHeaders: Add "X-Forward-*" headers
# ProxyVia: Add "Via" header
ProxyRequests Off
ProxyPreserveHost On
ProxyAddHeaders On
ProxyVia On
<Location __LOCATION__>
# Websocket Rewrite Settings # Websocket Rewrite Settings
RewriteEngine On RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC] RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule ^/?(.*)$ __WS_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/$1 [P,L] RewriteRule ^/?(.*)$ __WS_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/$1 [P,L]
# Reverse Proxy
# Reverse Proxy Settings
ProxyPreserveHost On
ProxyPass __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0 ProxyPass __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ retry=0
ProxyPassReverse __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/ ProxyPassReverse __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT__/
</location> </Location>
### ###
@ -169,10 +192,10 @@ features:
deny: | deny: |
# Deny Definition # Deny Definition
<FilesMatch "__REGEX__"> <LocationMatch "__REGEX__">
Order allow,deny Order allow,deny
Deny from all Deny from all
</FilesMatch> </LocationMatch>
server_status: | server_status: |
# Status Page # Status Page