Am un server Apache cu câteva site-uri.
Aș dori să rulez pe acest container docker de server cu Mercure și să îl partajez pe Internet.
Am găsit informații pe Internet că am nevoie pentru a folosi ProxyPass și ProxyPassReverse în configurația vhost.
Configurația mea vhost:
<VirtualHost *:80>
    ServerName tomaszf.pl
    ServerAlias www.tomaszf.pl
    DocumentRoot /var/www/html/mercurytest/public
    DirectoryIndex /index.php
    <Directory /var/www/html/mercurytest/public>
        AllowOverride None
        Order Allow,Deny
        Allow from All
        FallbackResource /index.php
    </Directory>
    <FilesMatch \.php$>
        SetHandler "proxy:unix:/var/run/php/php8.0-fpm.sock|fcgi://localhost"
    </FilesMatch>
    <Directory /var/www/html/mercurytest/public/bundles>
        DirectoryIndex disabled
        FallbackResource disabled
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/tomaszf.pl.error.log
    CustomLog ${APACHE_LOG_DIR}/tomaszf.pl.log combined
 
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.tomaszf.pl [OR]
    RewriteCond %{SERVER_NAME} =tomaszf.pl
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
    ServerName tomaszf.pl
    ServerAlias www.tomaszf.pl
    DocumentRoot /var/www/html/mercurytest/public
    DirectoryIndex /index.php
    <Directory /var/www/html/mercurytest/public>
        AllowOverride None
        Order Allow,Deny
        Allow from All
        FallbackResource /index.php
    </Directory>
    <FilesMatch \.php$>
        SetHandler "proxy:unix:/var/run/php/php8.0-fpm.sock|fcgi://localhost"
    </FilesMatch>
    <Directory /var/www/html/mercurytest/public/bundles>
        DirectoryIndex disabled
        FallbackResource disabled
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/tomaszf.pl.error.log
    CustomLog ${APACHE_LOG_DIR}/tomaszf.pl.log combined
    SSLCertificateFile /etc/letsencrypt/live/tomaszf.pl/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/tomaszf.pl/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    ProxyPass /mercure http://127.0.0.1:8099/
    ProxyPassReverse /mercure http://127.0.0.1:8099/
</VirtualHost>
Containerul Docker este lansat cu comanda:
docker run \
    -e SERVER_NAME=':80' \
    -e MERCURE_PUBLISHER_JWT_KEY='!ChangeMe!' \
    -e MERCURE_SUBSCRIBER_JWT_KEY='!ChangeMe!' \
    -p 8099:80 \
    -e CORS_ALLOWED_ORIGINS='https://tomatszf.pl' \
    -e DEBUG=1 \
    -e ALLOW_ANONYMOUS=1 \
    dunglas/mercure caddy run -config /etc/caddy/Caddyfile.dev
Problemă:
Când încercați să intrați pe site-ul web tomaszf.pl/mercure, adresa din browser este schimbată automat la 127.0.0.1 și site-ul nu funcționează.
Ce trebuie să schimb în configurație?