Running Wordpress in a VM with Caddy Reverse Proxy

1. Output of caddy version:

Not relevant

2. How I run Caddy:

a. System environment:

Windows 10

b. Command:

./caddy run --config ./Caddyfile

d. My complete Caddy config:

Caddyfile

home.movies4you.stream {

root * C:\Tools\OrganizrV2\www\organizr\html

php_fastcgi localhost:9000

rewrite /api/v2/* /api/v2/index.php?{query}

file_server

    tls {
        dns cloudflare (cloudflare key)
    }
}
requests.movies4you.stream {
    reverse_proxy 127.0.0.1:5055
    tls {
        dns cloudflare  (cloudflare key)
    }
}
accounts.movies4you.stream {
    reverse_proxy 127.0.0.1:8056
    tls {
        dns cloudflare  (cloudflare key)
    }
}
tv.movies4you.stream {
    reverse_proxy 127.0.0.1:8096
    tls {
        dns cloudflare (cloudflare key)
    }
}
deluge.movies4you.stream {
    reverse_proxy 127.0.0.1:8112
    tls {
        dns cloudflare  (cloudflare key)
    }
}
adg.ittechnut.com {
    reverse_proxy 192.168.1.111:3000
    tls {
        dns cloudflare (cloudflare key)
    }
}
photos.movies4you.stream {
    reverse_proxy 127.0.0.1:2342
    tls {
        dns cloudflare  (cloudflare key)
    }
}
ha.movies4you.stream {
    reverse_proxy 192.168.1.126:8123
    tls {
        dns cloudflare  (cloudflare key)
    }
}
ittechnut.com {
    reverse_proxy 192.168.1.128
    tls {
        dns cloudflare  (cloudflare key)
    }
}

3. The problem I’m having:

hey so quick question. Im running wordpress in a vm on hyper-v using this iso WordPress | TurnKey GNU/Linux when i type in local 192.168.1.128 it brings me to my wordpress site. I want to reverse proxy it. my caddy is running on 192.168.1.111. I have other webapps running like so in a reverse proxy
I saw this example but do not know how this will work for me since my wp is on a different ip than my caddy but i do have apache running on this turnkey vm. Any help would be greatly apprecaited.

example.com {
    root * /home/illuminate/php_sites/wordpress
    php_fastcgi unix//run/php/php8.0-fpm.sock
    file_server
    encode gzip

    @disallowed {
        path /xmlrpc.php
        path *.sql
        path /wp-content/uploads/*.php
    }

    rewrite @disallowed '/index.php'
}

would this work

newdomain.com {
    reverse_proxy 192.168.1.128
    tls {
        dns cloudflare (cloudflare key)
    }
}

5. What I already tried:

6. Links to relevant resources:

FYI you can make this a lot less annoying by using a Caddyfile snippet to copy this into each site:

Yes, that should work. Did you try it?

yes it works but it is really messed up something graphically

That implies the CSS files aren’t loading. Check your browser’s network tab and see what you can find out.

Also, turn on the debug global option in Caddy and check you logs, see what it shows for some of these requests.

i see this issue which is exactly what I am dealing with but it is nginx. Is there a way to do this with caddy

Go down 3/4 of the way down the page

That’s not a change in Caddy that they’re talking about, it’s a change in a WordPress config file.

for anyone else who is having this issue follow this tutorial

edit your
/var/www/(wordpress-dir)/wp-config.php

i have since fixed the issue

1 Like

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