Dokku WordPress max upload filesize

860 views Asked by At

I want to run WordPress 4.7 with nginx on Dokku 0.72, Ubuntu 16.04.1 LTS and the only problem I have is the maximum upload filesize (2MB) that I can't increase.

My Procfile is the following:

web: vendor/bin/heroku-php-nginx -C app.conf public/

I tried to set client_max_body_size in the app.conf and I added a custom conf in /home/dokku/../nginx.conf.d as described in Dokku docs.

Also the WP_MEMORY_LIMIT in wp-config did not help.

And I tried to set a custom .user.ini described in Heroku docs.

Nothing works and I have no idea what to do now.

app.conf:

index index.php;

location ~ /\. {
    deny all;
}

location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
}

location / {
    try_files $uri $uri/ /index.php?$args;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
  access_log off; log_not_found off; expires max;
}

client_max_body_size 50M;

composer.json:

{
    "name": "../..",
    "authors": [
        {
            "name": "Marvin Engelmann",
            "email": ".."
        }
    ],
    "require": {
        "php": "7.0.14"
    }
}

EDIT:

I found a solution:

I added a custom php.ini parameter in Procfile like:

web: vendor/bin/heroku-php-nginx -C nginx.conf -i php.ini public/

and added a custom php.ini file:

upload_max_filesize = 50M
post_max_size = 50M
2

There are 2 answers

1
Mixpeal On

PROBLEM:

My upload_max_filesize is limited to 2M when i run

dokku run appName php -ini | grep upload_max_filesize

SOLUTION:

  1. create a .user.ini file exactly where your index.php is, if you are using laravel, your index.php will be inside public folder

  2. paste this code inside it then commit and push your code upload_max_filesize = 512M post_max_size = 512M

0
xploshioOn On

try something like this

mkdir /home/dokku/myapp/nginx.conf.d/
echo 'client_max_body_size 50M;' > /home/dokku/myapp/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/myapp/nginx.conf.d/upload.conf
service nginx reload