Case:

If you are using memcached in a docker container you will see, that the memcached cache still not grow, on you wordpress dashboard side. You changed your nginx config and you can see your site, but the cache is still empty.

Simple Solution:

1.) Go into the wordpress path where the plugin is installed
for example: ovks_de/wp-content/plugins/cachify/inc/

2.) Edit the File cachify_memcached.class.php

3.) Go to the last section

4.) Edit the 127.0.0.1 to the name of your docker container or to the ip of your docker container.

Long Solution with explanation

1.) Name your memcached Docker Container

If you are using docker-compose, you can do it the easy way.
The network section can be deleted, if you are not using your own network section. If you use your own, memcached has to be a part of the network of nginx and php, too.

2.) NGINX Config for memcached and cachify

You CAN NOT use the example of the config page of the plugin.
WordPress –> Plugin –> Cachify –> Preferences –> Second Tab
You have to change the „localhost“ from „memcached_pass“ to the name of the docker container:
from:
memcached_pass localhost:11211;
to:
memcached_pass memcached:11211;

3.) Does php and memcached work correctly?

1.) Lets test it!
Just create a PHP file in your WordPress-Directory and name it.

Browse to: https://example.com/memcached_test.php

Can you see „it works„? Yes? Cool, go further!
Your Memcached Server is working right now.

4.) Make cachify docker and memcached ready! Hurray!

To get „cachify for wordpress“ docker ready, you have to change one line in the code!

You have to change the „connect section“ of cachify cachify_memcached.class.php from localhost to memcached

Edit the 127.0.0.1 to the name of your docker container or to the ip of your docker container.

In the array, you have to change the „127.0.0.1“ to „memcached“.

Hurray! You did it! Now, go to your Website and surf a little bit on it and you can see in the wordpress backed that the cache amount still grow. You can find that on the dashboard site „At A Glance“.

How to run cachify on docker with nginx and php
Markiert in: