How to increase maximum file uploads with WordPress in Coolify
Much needed “simple guide” to help users edit the maximum file uploads for WordPress inside of a Docker container in Coolify.
What is Coolify?
I am a recent convert to Coolify. Coolify calls itself the self-hosting Heroku/Netlify alternative. I would better describe Coolify as "... an open source platform as a service providing; edge computing, web hosting, database hosting, and content delivery network solutions." It uses Docker containers to install the applications and services you need. Check Coolify’s documentation for the entire list you can install. You can also use Dockerfile to install needed software, but it is still somewhat in beta.
Why I chose Coolify?
I have recently started using WordPress as a headless CMS for SvelteKit and Astro. They are currently running on my LEMP VPS with Linode. I have two others hosted at Namecheap. Since they are headless, I decided I wanted to run them using just Dockers. This will help save time with installations and management. With Coolify, I can make this process even easier. To me, Coolify acts as the main frontend (PaaS) to the Docker containers.
Using WordPress in Coolify
To get WordPress running, all you need to do is add a WordPress service. You will set up your domain in the configuration. Be sure you have your domain pointed to your server first. With a click of the button, WordPress is installed. Configuring WordPress is the same afterwards. Just enter your WordPress domain and you will the familiar setup screen.
After you logged in to your admin interface, you can install the same plugins that you would use with your other headless WordPress instances. You can see below which plugins I used for REST API and GraphQL.
Increasing Maximum File Uploads in Coolify
So, the only issue you may face with your Coolify WordPress installations is that first upload error you try to upload a plugin. It is quite familiar with WordPress users. In the normal case, I would have edited php.ini inside of my Nginx to allow larger file sizes. With Coolify, since it is using Docker containers, the easiest solution is to SSH into the Docker container. Then you will use the docker command to list the container ids:
$ docker ps
You may need to use sudo. Look for your WordPress container. You should get a result similar to below:
2e7872g82l34 wordpress:php8.2
The letter and number combination is your Docker container ID. Then you connect to the container with the following command:
$ docker exec -it <container name> /bin/bash
For the example with my container, I entered:
$ docker exec -it 2e7872g82l34 /bin/bash
If you are a server administrator, you are back in familiar territory. You will need a text editor to make file changes. With this Docker container, I needed to update the packages first and then I installed nano.
$ apt update
$ apt install nano
Of course, if you are a vi fan, you can install that editor.
For me, the easiest way to increase the maximum file uploads was to edit the .htaccess file directly. If there is not .htaccess file, you can create a new one. Since I used the WebP Express plugin, .htaccess was created for me.
$ nano .htaccess
Then I added the following to the .htaccess file and saved.
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
Be sure to exit your container and server.
$ exit
$ exit
You will need to restart your Coolify system. After it reloads, you should be able to upload files larger than 2M.
Conclusion
I have not tried editing php.ini in the container since I saw the .htaccess file. I also do not know what will happened to .htaccess if I update that particular Docker container.
Still, I think if you are running WordPress decoupled and headless, there is really no need to manage your own server. Coolify will do that job for you, though you will still need to maintain your server’s updates.
Tell me what you think. How were you able to make edits to your Docker containers in Coolify?
Message me on Twitter (@MatsunagaKevin) or on Mastodon.