Hi, some bot for some reason really needs to scrape my wordpress blog over and over again, overheating my poor celeron.

For laziness I am just using the default wordpress docker image, which is php+apache.

I did some experiments and with php-fpm+caddy it’s much faster.

Now i want to migrate all my wordpress blogs, five in total and I want to manage them from a single caddy instance.

php-fpm needs to be mounted in the same path or it can be different?

For example, the wordpress install places the files in /var/www/html, and so for Caddy I mount in the same path and in the Caddyfile i have:

test.example.com{
        root * /var/www/html
        php_fastcgi wordpress:9000
        file_server
}

if i have multiple installs can I mount different paths like /var/www/html2 and so on (but only on caddy) or it must match both containers?

EmasXP
link
fedilink
English
2
edit-2
1Y

I’ve only used Caddy as a reverse proxy in production, but on my development machine I use Caddy with php-fpm. That makes me a bit unsure if I understand your questions correctly.

For me that would look something like this:

test.example.com {
	root * var/www/html
	php_fastcgi unix//run/php/php7.4-fpm.sock
	file_server
}

(Yeah, PHP 7.4, I know)

It looks like your Docker (?) image is exposing the php-fmp socket? I did not even know that was possible, but I don’t doubt it is.

Caddy has no issues serving multiple hosts from the same server, it can even be with different php-fpm sockets. Caddy will just nod at you, maybe silently question your choice of still running PHP 7.4, but it accepts it and runs. Just make another block with a different host in the same Caddyfile, and it will work just fine.

@Moonrise2473@feddit.it
creator
link
fedilink
English
11Y

I found my answer here at stackoverflow and it worked

basically, it needs to tell the absolute path of php-fpm with the root directive insde php_fastcgi

localhost:80 {
    root * /srv/www
    encode gzip
    php_fastcgi php:9000 {
        root /var/www/html
    }
    file_server
    log
}

then, i had to take care of permissions, because even if caddy is run as root, php-fpm is run as www-data , so the directory ownership need to be assigned to that

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 279 users / day
  • 589 users / week
  • 1.34K users / month
  • 4.55K users / 6 months
  • 1 subscriber
  • 3.47K Posts
  • 69.4K Comments
  • Modlog