NGINX Child Template to Accept Uknown Hosts

I have a Trellis site set up on AWS (ELB, EC2, RDS). Our health checks are failing because hitting the site IP directly returns a 502.

I believe I need to overwrite the NGINX config to accept unknown hosts to make this work correctly. Has anyone ever run into an issue like this?

Trellis includes two nginx configs no-default.conf.j2 and to

Drop requests for unknown hosts

They are listed for inclusion in main.yml:

Thanks for the response. I don’t think I exactly understand what those configs are set to do though, seems like they’re attempting block unknown hosts, whereas I want to wildcard accept any.

For future reference of anyone, I was able point the IP addresses by adding them to the redirects list under site_hosts in wordpress_sites.yml, even though the docs say you can’t, ie:

      - canonical:
          - 55.555.55.555

Here is what I used on AWS ALB:

      - canonical: # Useless, just make it easier for human to see which site is it
      - canonical: _ # Important for AWS Application Load Balancer


You also need to set up some health check endpoints for ALB as well. I generate it during deploy:

  - name: .env config
    src: roles/deploy/templates/env.j2
    dest: .env
  - name: health-check.php for AWS ALB
    src: roles/aws-alb/templates/health-check.php.j2
    dest: web/health-check.php
// roles/aws-alb/templates/health-check.php.j2
// {{ ansible_managed }}
echo 'one apple a day keeps the doctor away';

This topic was automatically closed after 42 days. New replies are no longer allowed.