Wordpress with Caddy V2

1. Caddy version (caddy version):

V2.2.1

2. How I run Caddy:

a. System environment:

Debian 10 normal install via apt install caddy

b. Command:

systemctl start caddy.service

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

myblog.mydomain.com {

        root * /var/www/html/blog.com

        file_server

        encode gzip
        php_fastcgi unix//run/php/php7.3-fpm.sock

log     {
        output file /var/log/caddy/stephaniebreton.com.log
        format console
        }
}

3. The problem I’m having:

I can access myblog.mydomain.com but then permalinks are not working and access to wp-admin is not working. I tried to add in the Caddyfile: try_files {path} /index.php?{query}&p={path} but it also does not work. Basically whenever there is myblog.mydomain.com/[path] it does not work as it does not add the “index.php” in the uri, finally anything like myblog.mydomain.com/wp-admin/anyfile.php will not work such as myblog.mydomain.com/wp-admin/update-core.php

4. Error messages and/or full log output:

5. What I already tried:

I tried try_files {path} /index.php?{query}&p={path} but when i query a page it shows 404 error and sometimes after refreshing it works sometimes not.
I have searched for the past two days but all the config i see for wordpress are minimal and does not work for me

6. Links to relevant resources:

Thanks for your help as i am currently with Nginx but would like to use Caddy if i can get this wordpress to work.

You say “does not work”, but what isn’t working exactly? What’s the actual problem? What are in your logs? What do you see in your browser? What if you try with curl -v, what happens?

I just upgraded to caddy v2 and I am having this same exact issue. The main static page loads just fine, but trying to go to any other page besides the home page just loads a blank, white page.

Not sure if this helps, but this is part of the code I used to use in v1

rewrite / {
to /index.php?q={query}

@TonyNof there’s not nearly enough information for us to help. Please open a new thread and fill out the thread template.

Done :blush:

https://caddy.community/t/issue-with-caddy-v2-and-wordpress/10375

This is the caddyfile code I used to get wordpress working again on my site.

www.fuzavue.com, fuzavue.com {

root * /Applications/MAMP/htdocs/fuzavue
encode gzip
log {
output file /Users/glen/var/log/caddy/fuzavue.log
}
#push {
#}
php_fastcgi / 127.0.0.1:9000
file_server

route {
# Add trailing slash for directory requests
@canonicalPath {
file {
try_files {path}/index.php
}
not path */
}
redir @canonicalPath {path}/ 308

# If the requested file does not exist, try index files
@indexFiles {
	file {
		try_files {path} {path}/index.php index.php
		split_path .php
	}
}
rewrite @indexFiles {http.matchers.file.relative}

@phpFiles {
	path *.php
}
reverse_proxy @phpFiles 127.0.0.1:9000 {
	transport fastcgi {
		split .php
	}

}
}
}

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