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:

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


    image: jwilder/nginx-proxy
      - "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;

1 Answer 1



proxy_set_header Host $host;


proxy_set_header Host $http_host;

fixed the issue.


  • OMG this solved me so much headache! Thank you!!!
    – Moshe
    Apr 15, 2019 at 16:02
  • @moshe I'm happy to help! Apr 15, 2019 at 16:32
  • Solved for me, too. Thank you!
    – ctc
    Jun 16, 2020 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, 2020 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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