How to connect official wordpress docker-container via https

  • Dear all...


    I've a problem to connect to my wordpress page via my duckdns domain (https).
    On my local network I can connect to my wordpress page. When I switch the url iin wordpress to my duckdns domain (https) I can not connect anymore.
    I'm already running nextcloud via letsencrypt and duckdns. That works like charm. I connected the official docker wordpress container to a specified docker network in which nextcloud and letsencrypt are already in. The wordpress container can only exposes port 80, could that be the problem? Could somebody give m some advice, how to get it work?


    Many thanks in advanced for any suggestions.

  • Hello everybody...


    running mariadb, duckdns, letsencrypt and wordpress with docker. On my local network everything works fine. With my duckdns domain it doesn't work. I did some research, but still no success.
    I changed my wordpress.subdomain.conf (nginx letsencrypt) and my wp-config.php.



    In wp-config.php I added the following line.

    Code: wp-config.php
    ...
    
    
    define('FORCE_SSL_ADMIN', true);
    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
           $_SERVER['HTTPS']='on';
    
    
    ...

    Tried it also with these lines from the info-page of docker official images wordpress.

    On local side everything works. Via my duckdns domain no chance. I'm unable to connect. When I try to reach my site via https:\\domain.duckdns.org it's going to try port 8080. But this port isn't open and it shouldn't go throw this.
    Anybody any solution?
    Many thanks in advanced...

  • Thanks for the input Morlan.


    I changed in the wordpress.subdomain.conf the proxy_pass and restarted letsencrypt.
    Then I had my OMV login screen on https://example-blog.yourdomain.duckdns.org.
    That's also good. My goal was only to get my blog on that domain.


    My wordpress docker forwards port 8080 -> 80. So that's why I put 8080 to proxy_pass.
    The configs are now looking like that.


    Code: wp-config.php
    ...
    
    
    define('FORCE_SSL_ADMIN', true);
    if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
           $_SERVER['HTTPS']='on';
    
    
    ...


    I still can only connect to the blog on my local network. :(

  • Ok I misunderstood your comment:

    Zitat

    The wordpress container can only exposes port 80

    Unfortunately I am not familiar with the wordpress docker. Your wordpress.subdomain.conf looks fine (right now https://mydomain.duckdns.org should be redirected to http://xxx.xxx.xxx.xx:8080. Which error message do you get? And what wordpress docker are you using ?

  • I'm also expecting that the problem is somewhere in the wordpress configuration.


    Using the official wordpress docker (Docker official images).
    https://hub.docker.com/_/wordpress


    On the official wordpress docker info page is a link how to use wordpress docker with a reverse proxy.
    Following lines should be added to wp-config.php.


    When I try to connect to my blog page firefox shows:


    The page isn’t redirecting properly


    An error occurred during a connection to mydomain.duckdns.org.


      This problem can sometimes be caused by disabling or refusing to accept cookie



    I also looked in the wordpress database (wp_options) for siteurl (http://xxx.xxx.xxx.xx:8080) and home (https://mydomain.duckdns.org).
    That's the actual state and no connection local and via mydomain. When I set both (siteurl and home) to http://xxx.xxx.xxx.xx:8080 I can reach my page on local network. I also tried both (siteurl and home) to https://mydomain.duckdns.org same like actual (first mentioned) database entry's. ?(

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!