Importing large xml file

I’m trying to import a content xml wordpress file to a develop environment. The file has 26mb and Nginx returns

413 Request Entity Too Large

I edited /etc/nginx/nginx.conf adding

client_max_body_size 200m;

(as documentation say)

Also, I edited /etc/php5/fpm/php.ini adding

memory_limit = 32M
upload_max_filesize = 200M
post_max_size = 300M

After restart Nginx, nothing change. Iknow this issue is all about third party software. In order to keep on topic I ask about specific Trellis configuration. There is something I must to know about it?

Thanks a lot. This simple issue involves a lot of things: Vagrant boxes, Nginx and php, actually away of my knowledge.

You did re-provision (run server.yml) after editing those values I assume?

edit: oops read too quickly and I see that you edited those files directly on the server. Maybe you did that just to test it quickly but always update those values in the Trellis configs itself. You ideally never want to make manual changes like those straight on the server.

1 Like

The value you edited in nginx.conf most likely gets overridden one in the WP site config.

See So you should be setting php_post_max_size in a group_vars file and re-provisioning.


I did it but nothing changed. I put
php_post_max_size: 40m inside group_vars/development/wordpress_sites.yml
inside specific site, between system_cron and env. Here is:
    local_path: ../contraindicaciones # path targeting local Bedrock site directory (relative to Ansible root)
    site_install: true
    site_title: contraindicaciones
    admin_user: aitor
    admin_password: **************
      enabled: false
      subdomains: false
      enabled: false
      enabled: false
      duration: 30s
    system_cron: true
    php_post_max_size: 40m
      wp_env: development
      db_name: contraindicaciones_dev
      db_user: aitor_contraindicaciones
      db_password: ****************

Is it right place?
I did first a vagrant destroy and vagrant up again because an error in vagrant provision so, system core is clean. I this order:

vagrant destroy
vagrant up
vagrant provision (with php_post_max_size: 40m)

Also I tried with errors:

$ ansible-playbook -i hosts/development server.yml

PLAY [Determine Remote User] ************************************************** 

TASK: [remote-user | Determine whether to connect as root or admin_user] ****** 
ok: [ ->]

TASK: [remote-user | Set remote user for each host] *************************** 
ok: []

TASK: [remote-user | Announce which user was selected] ************************ 
ok: [] => {
    "msg": "Note: Ansible will attempt connections as user = aitor"

PLAY [WordPress Server - Install LEMP Stack with PHP 5.6 and MariaDB MySQL] *** 

GATHERING FACTS *************************************************************** 
fatal: [] => SSH Error: ssh: connect to host port 22: Connection refused
    while connecting to
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

TASK: [common | Validate Ansible version] ************************************* 
FATAL: no hosts matched or all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/aitor/server.retry                  : ok=3    changed=0    unreachable=1    failed=0


I edited group_vars/development/php.yml instead wordpresss_sites.yml:

php_post_max_size: '40m'

First, Nginx allow to upload file, but WordPress show me another error about upload_max_filesize exceed. So, I wrote another line at php.yml:

php_upload_max_filesize: '40m'

It works! Thank you for the help.

1 Like

Sorry, @swalkinshaw, a last question. When I try to do the same at production environment, there is no php.yml inside /group_vars/production. Should I create it?

It doesn’t exist because our defaults are meant for production. So just create it and override that one variable :smile:

1 Like

I keep in troubles. Everything seems ok at remote server WP interface. Import plugin shows a 40mb max file size allowed. I upload my 26mb xml file.

After a minute uploading, upload stop and a mesage is shown “connection was reset”.

I’m lost. What is the problem?


Solved again, using wp CLI import. Sorry about noise.

1 Like

try to add the max_execution_time and set it to 300. // 300s = 5Minutes


Hi, I’m a newbie and I don’t know how can I increase “max time execution”.

I edited “group_vars/development/php.yml” as Aitor did with the other variables.

Then " vagrant reload ".

But it doesn’t seem to work.

Thanks in advance.

You’d need to run vagrant provision again. reload isn’t enough.

1 Like

Thanks @swalkinshaw, it worked perfectly.

I tried vagrant up but it didn’t work either.