From c66ea46c6446648fdd796b3adfb7e8d69e8987ac Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Thu, 17 Oct 2024 15:32:11 +0200 Subject: [PATCH] Kapitel 12: (Reverse)Proxy --- conf/kapitel/kapitel_12.conf | 132 +++++++++++++++++++++++++++ tomcat10.config/server.xml | 153 ++++++++++++++++++++++++++++++++ tomcat10.config/server.xml.ORIG | 152 +++++++++++++++++++++++++++++++ 3 files changed, 437 insertions(+) create mode 100644 conf/kapitel/kapitel_12.conf create mode 100644 tomcat10.config/server.xml create mode 100644 tomcat10.config/server.xml.ORIG diff --git a/conf/kapitel/kapitel_12.conf b/conf/kapitel/kapitel_12.conf new file mode 100644 index 0000000..50400b7 --- /dev/null +++ b/conf/kapitel/kapitel_12.conf @@ -0,0 +1,132 @@ +##### Kapitel 12 + +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_connect_module modules/mod_proxy_connect.so +LoadModule proxy_ftp_module modules/mod_proxy_ftp.so +LoadModule proxy_http_module modules/mod_proxy_http.so + +### Forward-Proxy + +ProxyVia full + +Listen 127.0.0.1:3128 + + + + Require ip 127.0.0.0/8 + + + ProxyRequests On + + CustomLog logs/proxy_access.log combined + ErrorLog logs/proxy_error.log + + +### Forward-Proxy mit Caching + +#LoadModule proxy_module modules/mod_proxy.so +#LoadModule proxy_connect_module modules/mod_proxy_connect.so +#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so +#LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule cache_module modules/mod_cache.so +#2.2#LoadModule disk_cache_module modules/mod_disk_cache.so +LoadModule cache_disk_module modules/mod_cache_disk.so + +Listen 127.0.0.1:3142 + + + + Require ip 127.0.0.0/8 + + + ProxyRequests On + + CacheEnable disk http://* + CacheRoot /usr/local/apache2/proxy-cache/ + CacheDirLevels 2 + CacheDirLength 2 + +# CacheMinFileSize 1 +# CacheMaxFileSize 10000000 +# +# CacheDefaultExpire 3600 +# CacheMinExpire 600 +# CacheMaxExpire 86400 +# +# CacheLastModifiedFactor 0.1 +# CacheIgnoreNoLastMod On +# +# CacheStoreNoStore On +# CacheStorePrivate On +# + CustomLog logs/caching_access.log combined + + LogLevel debug + ErrorLog logs/caching_error.log + + +### Reverse-Proxy für Heise-Newsticker + + + ServerName revproxy.sv + + ProxyPass /newsticker/ https://www.heise.de/newsticker/ + ProxyPassReverse /newsticker/ https://www.heise.de/newsticker/ + ProxyPassReverse /newsticker/ https://193.99.144.85/newsticker/ + ProxyPassReverse /newsticker/ https://193.99.144.80/newsticker/ + + SSLProxyEngine On + + CustomLog logs/revproxy_access.log combined + ErrorLog logs/revproxy_error.log + + +### Reverse-Proxy für PHP-FPM + +#LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so + + + ServerName revproxy-php.sv + + + SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost" + + + ProxyPassMatch "^/(.*\.php0(/.*)?)$" "fcgi://127.0.0.1:4001/usr/local/apache2/htdocs/$1" + + CustomLog logs/revproxy-php_access.log combined + ErrorLog logs/revproxy-php_error.log + + +### Reverse-Proxy für Tomcat + +#LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_ajp_module modules/mod_proxy_ajp.so +LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so + + + ServerName tomcat.sv + + DocumentRoot /usr/share/tomcat10-examples/ + + RewriteEngine On + RewriteRule ^/examples/(.*)\.jsp(x?)$ ajp://localhost:8009/examples/$1.jsp$2 [P,L] + + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d + RewriteRule ^/examples/websocket/(.*)$ ws://localhost:8080/examples/websocket/$1 [P,L] + + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d + RewriteRule ^/examples/(.*)$ ajp://localhost:8009/examples/$1 [P,L] + + + Require all granted + Options Indexes + + + CustomLog logs/tomcat_access.log combined + ErrorLog logs/tomcat_error.log + + diff --git a/tomcat10.config/server.xml b/tomcat10.config/server.xml new file mode 100644 index 0000000..1f790a9 --- /dev/null +++ b/tomcat10.config/server.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tomcat10.config/server.xml.ORIG b/tomcat10.config/server.xml.ORIG new file mode 100644 index 0000000..ad3f597 --- /dev/null +++ b/tomcat10.config/server.xml.ORIG @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +