• Resolved Deryck

    (@deryck)


    Hi,

    This issue is from Site Health but my environment is in docker. So I think is important to provide context.

    I am trying to set up a local WordPress environment using Docker Compose with Nginx reverse proxy. WordPress. works but in Site Health I get:

    Error: cURL error 28: Resolving timed out after 10000 milliseconds (http_request_failed)

    This my docker-compose file

        version: '3.1'
        
        services:
        
          web:
            image: nginx
            ports:
              - "80:80"
            volumes:
              - ./site.conf:/etc/nginx/conf.d/site.conf
            depends_on:
              - wordpress
              - db
        
          wordpress:
            image: wordpress
            expose:
              - 80
            environment:
              WORDPRESS_DB_HOST: db
              WORDPRESS_DB_USER: local_user
              WORDPRESS_DB_PASSWORD: secret
              WORDPRESS_DB_NAME: local
            volumes:
              - ./wordpress:/var/www/html
        
          db:
            image: mysql:5.7
            environment:
              MYSQL_DATABASE: local
              MYSQL_USER: local_user
              MYSQL_PASSWORD: secret
              MYSQL_ROOT_PASSWORD: root_secret
            ports:
              - 3306:3306
            volumes:
              - ./mysql:/var/lib/mysql

    this is my Nginx config file:

        upstream backend{
            server wordpress:80;
        }
        
        server {
            listen 80;
            listen [::]:80;
        
            index index.php index.html;
            server_name bedrock.local; 
            # error_log  /var/log/nginx/error.log;
            # access_log /var/log/nginx/access.log;
            # root /code/web;
        
            location / {
                proxy_pass https://backend/;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Real-IP $remote_addr;
            }
        
        }

    bedrock.local domain resolves locally with 127.0.0.1 in /etc/hosts
    I’m not using HTTPS (just HTTP) to simplify the test.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Marius L. J.

    (@clorith)

    Hiya,

    Having had this same conundrum while trying to make the dev-environment play nicely, I think I’ve got the remedy for you!

    What I had to do was in my docker-compose.yml file, add in a domain alias (since .local isn’t a known address internally in each container.

    If you have a look at https://github.com/WordPress/health-check/blob/3fee540621879cacac3e14dcc486ce606d24861a/docker-compose.yml#L70 you’ll see that in my front-facing webserver I added the local address I use as an alias, that makes docker push it into the hosts file of all containers in the same network so they’ll know where to route those requests.

    If i’m reading your setup right, you’ll want to do something similar on you web container, but remember to add a network reference to all containers that should know of the address.

    Thread Starter Deryck

    (@deryck)

    Hey Marius.

    Thank you so much. It works!

    I’ll check thoroughly your docker-compose.yml file. Looks like there’s a lot to learn from that file.

    Thanks man.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error: cURL error 28: Resolving timed out after 10000 milliseconds (http_request’ is closed to new replies.