Folosesc proxy invers pentru a afișa conținutul serverului backend pentru un subdomeniu.
Subdomeniul.mydomain.com (serverul A) ar trebui să afișeze conținutul serverului cu IP 123.123.123.123 portul 1111 (server B).
Gazdă virtuală a subdomain.mydomain.com (server A):
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName subdomain.mydomain.com
SSLEngine on
SecAuditEngine On
RewriteEngine On
SSLProxyEngine on
ProxyPreserveHost On
LogLevel warn
<Directory />
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Location />
ProxyPass https://123.123.123.123:1111
ProxyPassReverse https://123.123.123.123:1111
</Location>
ErrorLog /var/log/apache2/error.log
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLVerifyClient none
SSLVerifyDepth 1
SSLCertificateFile /etc/apache2/cert.site/chain_wildcard_site_combined.crt
SSLCertificateKeyFile /etc/apache2/cert.site/key_wildcard_site.key
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</VirtualHost>
</IfModule>
Gazdă virtuală a 123.123.123.123:1111 (server B):
<IfModule mod_ssl.c>
<VirtualHost 123.123.123.123:1111>
DocumentRoot /srv/www/site/htdocs
SSLEngine on
RewriteEngine On
SSLProxyEngine on
ProxyPreserveHost On
LogLevel warn
<Location "/">
Require ip 222.222.222.222
</Location>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /srv/www/site/htdocs>
Options -Indexes +FollowSymLinks +MultiViews
DirectoryIndex index.php
AllowOverride None
Require all granted
</Directory>
ErrorLog /srv/www/site/log/error.log
CustomLog /srv/www/site/log/access.log combined
CustomLog /srv/www/site/log/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLVerifyClient none
SSLVerifyDepth 1
SSLCertificateFile /etc/apache2/cert.site/chain_wildcard_site_combined.crt
SSLCertificateKeyFile /etc/apache2/cert.site/key_wildcard_site.key
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
Dacă încarc adresa URL:
https://subdomain.mydomain.com/dir/
se incarca cu succes.
Dacă încarc adresa URL (fără bară oblică finală):
https://subdomain.mydomain.com/dir
Rezultă pagina de eroare: ERR_CONNECTION_REFUSED.
EDIT1:
Execut comanda:
curl -IL https://subdomain.mydomain.com/dir
si am rezultatul asta:
HTTP/1.1 301 mutat permanent
Data: Luni, 23 august 2021 13:45:13 GMT
Server: Apache
Strict-Transport-Securitate: max-age=15768000; include SubDomains
Strict-Transport-Securitate: max-age=15768000; include SubDomains
Locație: https://subdomain.mydomain.com:1111/dir/
Tip de conținut: text/html; set de caractere=iso-8859-1
curl: (7) Nu s-a putut conecta la portul 1111 subdomain.mydomain.com: conexiune refuzată
EDIT2:
Am adăugat un slash final
<Location />
ProxyPass https://123.123.123.123:1111/
ProxyPassReverse https://123.123.123.123:1111/
</Location>
Dar încă primesc conexiune refuzata eroare.
Aveți idee de ce este eroarea rezultată, când lipsește slash-ul final?
Mulțumiri!