proxy setup 404

Discussion in 'ISPConfig 3 Priority Support' started by Stelios, Jan 31, 2025.

  1. Stelios

    Stelios Active Member HowtoForge Supporter

    Hi all,

    I have a docker stack with web/db/phpmyadmin. The web/db working fine but I can't make the phpmyadmin to server via mydomain.com/phpmyadmin
    if I put directly mydomain.com:9093 it works fine but not via mydomain.com/phpmyadmin
    I tried a few different directives but all seem to be ignored. See the last one that fails below.
    The main mydomain.com (from 8080 port) is working fine.

    Code:
    # Disable forward proxying
    ProxyRequests Off
    
    # Bypass Let's Encrypt ACME challenge
    ProxyPass /.well-known/acme/ !
    
    # Proxy PrestaShop (already working)
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
    
    # Alias for phpMyAdmin
    Alias /phpmyadmin /phpmyadmin/
    
    # Fix phpMyAdmin Reverse Proxy (Ensure proper forwarding)
    ProxyPass /phpmyadmin/ http://127.0.0.1:9093/
    ProxyPassReverse /phpmyadmin/ http://127.0.0.1:9093/
    
    # Fix subdirectory and static files issues
    <Location /phpmyadmin>
        ProxyPass http://127.0.0.1:9093/
        ProxyPassReverse http://127.0.0.1:9093/
        Require all granted
    </Location>
    
    # Ensure correct forwarded headers
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
    
    # Prevent Apache from serving the default ISPConfig page
    DocumentRoot /var/www/clients/client1/web1/web
    <Directory /var/www/clients/client1/web1/web>
        Require all granted
    </Directory>
    
    # Security Headers
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-XSS-Protection "1; mode=block"
    Header always set X-Frame-Options "SAMEORIGIN"
    
    # Prevent Apache from revealing version info
    ServerSignature Off
    ServerTokens Prod
    
    Any help is more than welcome.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you check that this whole config is in the actual vhost file? Maybe there is an error and the file was saved with .err file ending in sites-available folder.
     
  3. Stelios

    Stelios Active Member HowtoForge Supporter

    There is indeed a .err file. How do I know which part it affects it when it doesn't throw something?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Rename the vhost file to e.g. .bak, rename the .err file so that it is just named like the currently used vhost file, restart Apache/Nginx and see which error you get. You will have to reverse this then to start the web server again.
     
    Stelios likes this.
  5. Stelios

    Stelios Active Member HowtoForge Supporter

    Found 2 errors, fix them and still the same and now there is no .err file and nowhere any error.


    Code:
    # Disable forward proxying (security best practice)
    ProxyRequests Off
    
    # Bypass Let's Encrypt ACME challenge
    ProxyPass /.well-known/acme/ !
    
    # Proxy PrestaShop (already working)
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
    
    # Fix phpMyAdmin Reverse Proxy (Ensure proper forwarding)
    ProxyPass /phpmyadmin/ http://127.0.0.1:9093/
    ProxyPassReverse /phpmyadmin/ http://127.0.0.1:9093/
    
    # Ensure correct forwarded headers
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
    
    # Fix static files not loading in phpMyAdmin
    <Location /phpmyadmin/>
        ProxyPass http://127.0.0.1:9093/
        ProxyPassReverse http://127.0.0.1:9093/
        Require all granted
    </Location>
    
    # Security Headers
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-XSS-Protection "1; mode=block"
    Header always set X-Frame-Options "SAMEORIGIN"
    
    # Prevent Apache from revealing version info
    ServerSignature Off
    
     
  6. Stelios

    Stelios Active Member HowtoForge Supporter

    ok managed to fix it, this worked in case someone else come to the same issue.


    Code:
    # Disable forward proxying (security best practice)
    ProxyRequests Off
    
    # Bypass Let's Encrypt ACME challenge
    ProxyPass /.well-known/acme/ !
    
    # Proxy PrestaShop (already working)
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
    
    # Proxy phpMyAdmin
    ProxyPass /phpmyadmin/ http://127.0.0.1:9093/
    ProxyPassReverse /phpmyadmin/ http://127.0.0.1:9093/
    
    # Ensure correct forwarded headers
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Port "443"
    
    # Fix static files not loading in phpMyAdmin
    <Location /phpmyadmin/>
        ProxyPass http://127.0.0.1:9093/
        ProxyPassReverse http://127.0.0.1:9093/
        Require all granted
    </Location>
    
    # Security Headers
    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-XSS-Protection "1; mode=block"
    Header always set X-Frame-Options "SAMEORIGIN"
    
    # Prevent Apache from revealing version info
    ServerSignature Off
     
    till likes this.

Share This Page