Lukáš Bařinka
© 2021
REV 2.10
ProxyRequests
Enables/disables proxy service
Aktivuje nebo deaktivuje službu proxy
ProxyVia
Enables/disables HTTP header Via
Slouží k modifikaci HTTP hlavičky Via
ProxyVia On|Off|Full|Block
NoProxy
Sets (direct) access to resources without proxy usage
Nastavuje přístup bez použití proxy
ProxyRemote "*" "http://firewall.example.com:81"
NoProxy ".example.com" "192.168.112.0/21"
ProxyBlock
Words, hosts, or domains that are banned
Blokuje přístup ke specifikovanému hostiteli/doméně
ProxyBlock sputniknews.com
ProxyDomain
Default domain name for proxied requests
Názvy, které se nepodaří vyhodnotit se doplní o ProxyDomain
<Proxy>
Container for directives applied to proxied resources
Kontejner pro omezení platnosti direktiv na proxy server
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyRequests On
ProxyVia On
<Proxy *>
Require ip 192.168.1
</Proxy>
mod_auth
mod_auth
ProxyPass
directive
Maps remote servers into the local server URL-space
ProxyPass [path] !|url [key=value key=value …]]
!
does not use reverse proxy for specified pathProxyPass
directives using path
and ProxyPass
directives inside <Location>
containerProxyRequests
directive should usually be set off
ProxyPass
Mapuje cizí servery do místního URL
ProxyPass [path] !|url [key=value key=value …]]
!
zabraňuje použití proxy pro danou cestuProxyPass
s cestami (path
) a uvnitř kontejneru <Location>
(bez cesty)ProxyRequests
by většinou měla být vypnuta (off
)
ProxyPassReverse
directive
Adjusts the URL in HTTP response headers sent from a reverse proxied server
ProxyPassReverse [path] url
Location
, Content-Location
, URI
ProxyPass "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverse "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverseCookieDomain "backend.example.com" "public.example.com"
ProxyPassReverseCookiePath "/" "/mirror/foo/"
ProxyPassReverse
Upravuje URL v hlavičkách odpovědí
ProxyPassReverse [path] url
Location
, Content-Location
, URI
ProxyPass "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverse "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverseCookieDomain "backend.example.com" "public.example.com"
ProxyPassReverseCookiePath "/" "/mirror/foo/"
path
ProxyRequests Off
ProxyPass /oc1 http://www.othercorp1.em
ProxyPassReverse /oc1 http://www.othercorp1.em
ProxyPassMatch ^(/.*\.jpg)$ http://images.server.com$1
<Location>
container Without path
, that is taken from Location
ProxyRequests Off
<Location "/mirror/foo/">
ProxyPass "http://backend.example.com/"
</Location>
<Location "/mirror/foo/i">
ProxyPass "!"
</Location>
Only single ProxyPass
directive can be inside <Location>
container
ProxyPassMatch
instead of <LocationMatch>
for Regular Expressionspath
ProxyRequests Off
ProxyPass /oc1 http://www.othercorp1.em
ProxyPassReverse /oc1 http://www.othercorp1.em
ProxyPassMatch ^(/.*\.jpg)$ http://images.server.com$1
<Location>
Bez specifikace cesty (path
), která se vezme z Location
ProxyRequests Off
<Location "/mirror/foo/">
ProxyPass "http://backend.example.com/"
</Location>
<Location "/mirror/foo/i">
ProxyPass "!"
</Location>
Pouze jediná direktiva ProxyPass
může být uvnitř kontejneru <Location>
ProxyPassMatch
místo <LocationMatch>
(nefunguje) pro REProxyRemote
Remote proxy used to handle certain proxy requests (proxy behind proxy)
ProxyRemote match remote-server
Context: server, virtualhost
AllowCONNECT
Ports that are allowed to CONNECT through the proxy
AllowCONNECT port[-port] [port[-port]] …
Default: AllowCONNECT 443 563
, context: server, virtualhost
ProxyRemote
Vzdálená proxy k obsluze některých proxy požadavků (proxy za proxy)
ProxyRemote match remote-server
Kontext: server, virtualhost
AllowCONNECT
Rozsahy portů, které umožňují CONNECT
skrz proxy
AllowCONNECT port[-port] [port[-port]] …
Default: AllowCONNECT 443 563
, kontext: server, virtualhost
a2enmod proxy_connect
ProxyRequests On
SSLProxyEngine On
ProxyRemote * http://172.16.3.3:3128/
mod_proxy_balancer
)mod_lbmethod_byrequests
)mod_lbmethod_bytraffic
)mod_lbmethod_bybusyness
)mod_lbmethod_heartbeat
)mod_proxy_balancer
)mod_lbmethod_byrequests
)mod_lbmethod_bytraffic
)mod_lbmethod_bybusyness
)mod_lbmethod_heartbeat
)mod_status
modulemod_status
<Location "/balancer-manager">
SetHandler balancer-manager
Require host localhost
ProxyPass "!"
</Location>
http://httpd.apache.org/docs/2.4/howto/reverse_proxy.html#manager | http://httpd.apache.org/docs/2.4/images/bal-man-w.png
BalancerMember
directive
Adds a member to a load-balancing group
BalancerMember [balancerurl] url [key=value [key=value ...]]
Context: directory
balancerurl
is only needed when not within a <Proxy balancer://
>loadfactor
a decimal number which defines the weighted load <1,100>BalancerMember
Přidává člena do clusteru
BalancerMember [balancerurl] url [key=value [key=value ...]]
Kontext: directory
balancerurl
se nenastavuje/ignoruje, pokud je konfigurace uvnitř <Proxy balancer://
>loadfactor
Nastavuje relativní zátěž daného člena <1,100>
<Proxy balancer://hotcluster>
BalancerMember http://www1.mycorp.net:80 loadfactor=1
BalancerMember http://www2.mycorp.net:80 loadfactor=2
ProxySet lbmethod=bytraffic
</Proxy>
ProxyPass / balancer://hotcluster/
<Location "/balancer-manager">
SetHandler balancer-manager
Require host localhost
ProxyPass "!"
</Location>
It is important to exclude Location
/balancer-manager
from proxy processing.
Location
/balancer-manager
podléhá také proxy, proto je potřeba proxy pro tuto adresu zakázat.
a2enmod proxy_balancer → slotmem_shm
a2enmod lbmethod_bytraffic
mod_cache
module
Content caching uses other modules featuresStorage management modules
mod_cache_disk
module
Disk storage for cache
CacheEnable cache_type url-string
mod_cache
Odkládání obsahu využívá služeb dalších modulů (storage management modules)
mod_cache_disk
Odkládání na disk
CacheEnable cache_type url-string
<IfModule mod_cache_disk.c>
CacheRoot /var/cache/apache2/mod_disk_cache
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
CacheMaxFileSize 65536
CacheMinFileSize 1024
</IfModule>