1

I need to run a WordPress instance on a non-standard SSL port (8080). I'm using Docker containers and nginx as a reverse proxy.

Here's the relevant portions of docker-compose.yml:

  wordpress:
    image: wordpress:latest
    # no ports are open besides 80 internally exposed

(...)

  proxy:
    image: jwilder/nginx-proxy
    ports:
      - "8080:8080"

And for nginx.conf:

server {
        server_name domain.com;
        listen 8080 ssl;

        ssl_certificate certs/domain.crt;
        ssl_certificate_key certs/domain.key;

        # Proxy parameters
        #proxy_set_header       Host                    $host;
        proxy_set_header        X-Real-IP               $remote_addr;
        proxy_set_header        X-Forwarded-For         $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto       $scheme;

        proxy_buffering on;

       location / {
            proxy_pass      http://wordpress;
       }
2

Changing

proxy_set_header Host $host;

to

proxy_set_header Host $http_host;

fixed the issue.

(source)

| improve this answer | |
  • OMG this solved me so much headache! Thank you!!! – Moshe Apr 15 '19 at 16:02
  • @moshe I'm happy to help! – That Brazilian Guy Apr 15 '19 at 16:32
  • Solved for me, too. Thank you! – ctc Jun 16 at 8:23
  • 1
    For anyone wondering why, see stackoverflow.com/questions/15414810/…. "$host equals $http_host, lowercase and without the port number". Since we're on a non-standard port, we need $http_host, which includes the port number. – ctc Jun 16 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.