How to connect official wordpress docker-container via https

    • OMV 4.x
    • Resolved

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 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.
    • New

      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.

      Source Code: wordpress-subdomain.conf

      1. server {
      2. listen 443 ssl;
      3. listen [::]:443 ssl;
      4. server_name example-blog.*;
      5. include /config/nginx/ssl.conf;
      6. client_max_body_size 0;
      7. location / {
      8. include /config/nginx/proxy.conf;
      9. resolver 127.0.0.11 valid=30s;
      10. set $upstream_wordpress wordpress;
      11. proxy_max_temp_file_size 2048m;
      12. proxy_pass https://xxx.xxx.xxx.xx:8080;
      13. }
      14. }
      Display All

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

      Source Code: wp-config.php

      1. ...
      2. define('FORCE_SSL_ADMIN', true);
      3. if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
      4. $_SERVER['HTTPS']='on';
      5. ...
      Tried it also with these lines from the info-page of docker official images wordpress.

      Source Code: wp-config.php

      1. ...
      2. define('FORCE_SSL_ADMIN', true);
      3. // in some setups HTTP_X_FORWARDED_PROTO might contain
      4. // a comma-separated list e.g. http,https
      5. // so check for https existence
      6. if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
      7. $_SERVER['HTTPS']='on';
      8. ...
      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...

      The post was edited 1 time, last by birdhouse79 ().

    • New

      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 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.

      Source Code: wordpress.subdomain.conf

      1. server {
      2. listen 443 ssl;
      3. listen [::]:443 ssl;
      4. server_name mydomain.*;
      5. include /config/nginx/ssl.conf;
      6. client_max_body_size 0;
      7. location / {
      8. include /config/nginx/proxy.conf;
      9. resolver 127.0.0.11 valid=30s;
      10. set $upstream_wordpress wordpress;
      11. proxy_max_temp_file_size 2048m;
      12. proxy_pass http://xxx.xxx.xxx.xx:8080;
      13. }
      14. }
      Display All

      Source Code: wp-config.php

      1. ...
      2. define('FORCE_SSL_ADMIN', true);
      3. if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
      4. $_SERVER['HTTPS']='on';
      5. ...

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

      Ok I misunderstood your comment:
      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 ?

      The post was edited 1 time, last by Morlan ().

    • New

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

      Using the official wordpress docker (Docker official images).
      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.

      Source Code: wp-config.php (example)

      1. ...
      2. define('FORCE_SSL_ADMIN', true);
      3. // in some setups HTTP_X_FORWARDED_PROTO might contain
      4. // a comma-separated list e.g. http,https
      5. // so check for https existence
      6. if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
      7. $_SERVER['HTTPS']='on';
      8. ...

      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 (xxx.xxx.xxx.xx:8080) and home (mydomain.duckdns.org).
      That's the actual state and no connection local and via mydomain. When I set both (siteurl and home) to xxx.xxx.xxx.xx:8080 I can reach my page on local network. I also tried both (siteurl and home) to mydomain.duckdns.org same like actual (first mentioned) database entry's. ?(

      The post was edited 2 times, last by birdhouse79 ().

      Post by birdhouse79 ().

      This post was deleted by the author themselves ().