Want more timely Centmin Mod News Updates?
Become a Member

Wordpress WordPress - Image upload delay?

Discussion in 'Blogs & CMS usage' started by GamerJota, Mar 1, 2016.

Tags:
  1. GamerJota

    GamerJota New Member

    27
    4
    3
    Mar 1, 2016
    Chile
    Ratings:
    +12
    Local Time:
    5:02 PM
    1.11.2
    10.1.16-1
    Hey there! I hope someone can help me with this one.
    I have a few weird bugs on a WordPress Multisite installation.
    First one, when uploading media there is a big delay before the media starts to upload (2 mins+) and when it actually gets to upload it takes less than a second.
    Second, when saving anything (Articles, menus, widgets) most of time the browser keeps waiting infinitely but the POST was actually successful, sometimes it gets to load showing a similar behavior like the first problem.
    Third, most of the time when logging into the Dashboard of other sites it loads for around 3 minutes before getting to the dashboard, again similar behavior as the above problems.
    Besides that everything else is unbelievable fast compared to my old cPanel setup.

    Some information about my environment:
    Small EC2 instance at AWS (1vCPU 2GB RAM)
    CentOS 7 64-bit
    centminmod 123.09beta01
    Using Redis cache at nginx level
    WordPress 4.4.2
    Using Domain Mapping
    Using Redis Object Cache
    Using Nginx helper to clear Redis cache and for domain mapping aid
    Site is behind CloudFlare but I'm connecting directly using "hosts" for all the domains

    My nginx conf for this site:
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    map $uri $blogname{
    ~^(?<blogpath>/[^/]+/)sites/(.*)    $blogpath ;
    }
    map $blogname $blogid{
        default -999;
            include /home/nginx/domains/maindomain.com/public/wp-content/uploads/nginx-helper/map.conf ;
    }
    
    server {
    
      server_name maindomain.com www.maindomain.com domain2.com www.domain2.com domain3.com www.domain3.com;
    
      # ngx_pagespeed & ngx_pagespeed handler
      #include /usr/local/nginx/conf/pagespeed.conf;
      #include /usr/local/nginx/conf/pagespeedhandler.conf;
      #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/maindomain.com/log/access.log combined buffer=256k flush=60m;
      error_log /home/nginx/domains/maindomain.com/log/error.log;
    
      root /home/nginx/domains/maindomain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # Rewrites for WordPress SEO XML Sitemap
      rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
      rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    
      ## Admin Rewrites
      if (!-e $request_filename) {
          rewrite /wp-admin$ $scheme://$host$uri/ permanent;
          rewrite ^(/[^/]+)?(/wp-.*) $2 last;
          rewrite ^/[^/]+(/.*.php)$ $1 last;
         }
    
      # prevent access to ./directories and files
      location ~ (?:^|/)\. {
       deny all;
      }
    
      #include /usr/local/nginx/conf/wpincludes/maindomain.com/wpcacheenabler_maindomain.com.conf;
      #include /usr/local/nginx/conf/wpincludes/maindomain.com/wpsupercache_maindomain.com.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/wpincludes/maindomain.com/rediscache_maindomain.com.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      #try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        ##auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/maindomain.com/htpasswd_wplogin;
        #include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        #include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/maindomain.com/wpsecure_maindomain.com.conf;
      #include /usr/local/nginx/conf/php-wpsc.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    Example:
    http://i.imgur.com/m8SUUpf.jpg
    When uploading, media async-upload.php is Pending for a good while.

    http://i.imgur.com/l78s5JH.jpg
    When it starts to upload it's very fast (less than a second) and appears instantly when it finishes.

    Cheers!
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,161
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    6:02 AM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such.

    However, Centmin Mod users are free to help each other out and ask questions or give answers on this community forum. My hopes are that this community forum evolves so that more veteran long time Centmin Mod users help new Centmin Mod users out :)

    With that said
    • what's your ISP net connection upload speed to the wp server ?
    • what version of php used ?
    • size and dimensions of images uploaded ? any resizing or manipulation of uploaded image ?
    • have you checked chrome browser developer tools network and console tabs when you load pages and upload to wp installs ?
    • maybe any hints discussed at WordPress › Support » HTTP Error when uploading images (but not all failing!) ?
    • any improvements if you comment out include file in vhost usr/local/nginx/conf/wpincludes/maindomain.com/wpsecure_maindomain.com.conf ?
    • any improvements with all redis caching disabled ?
     
  3. GamerJota

    GamerJota New Member

    27
    4
    3
    Mar 1, 2016
    Chile
    Ratings:
    +12
    Local Time:
    5:02 PM
    1.11.2
    10.1.16-1
    • what's your ISP net connection upload speed to the wp server ?: VTR Banda Ancha S.A. and my upload speed directly to the server is 7.8 MBit/s.
    • what version of php used ?: 7.0.3
    • size and dimensions of images uploaded ? any resizing or manipulation of uploaded image ?: Not relevant, same behavior with any size, with or without manipulation.
    • have you checked chrome browser developer tools network and console tabs when you load pages and upload to wp installs ?: Yes, an example is at the bottom of my last post and also on this one.
    • maybe any hints discussed at WordPress › Support » HTTP Error when uploading images (but not all failing!) ?: None, I have no HTTP errors or other errors, just the delay.
    • any improvements if you comment out include file in vhost usr/local/nginx/conf/wpincludes/maindomain.com/wpsecure_maindomain.com.conf ?: None.
    • any improvements with all redis caching disabled ?: None.
    This doesn't happens with the main site of the WordPress Multisite installation, only with other sites.
    Also a picture of what Edge shows on the Network tab: http://i.imgur.com/V0oOoig.jpg
    My Multisite configuration is based from: Wordpress - Wordpress Multisite + FastCGI_Cache + Pagespeed + Cloudflare | Centmin Mod Community

    EDIT: Happens whether "Redirect administration pages to site's original domain (remote login disabled if this redirect is disabled)" of Domain Mapping's Domain Options is enabled or disabled.
    TTFB is always 168ms~

    EDIT 2: Alright, found the conflict, it's "Sucuri Security - Auditing, Malware Scanner and Hardening", disabling it fixes the problem.
    Gonna' try to find out what's the conflict and check my settings, so yeah... If anyone else happens to end up having a problem like this on a Multisite installation, watch out for this plugin.
     
    Last edited: Mar 1, 2016
    • Informative Informative x 2
  4. eva2000

    eva2000 Administrator Staff Member

    30,161
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    6:02 AM
    Nginx 1.13.x
    MariaDB 5.5
    wow learnt something new today !
     
  5. GamerJota

    GamerJota New Member

    27
    4
    3
    Mar 1, 2016
    Chile
    Ratings:
    +12
    Local Time:
    5:02 PM
    1.11.2
    10.1.16-1
    Yeah :/ I really didn't expect this plugin to be the conflict, I really got used to it and liked it, sadly I can't find what's the problem.
    Do you have any ideas of a good security plugin that is not bloated and has fair compatibility with nginx @eva2000?

    EDIT: Using Wordfence for security now, they look very active and have nginx compatibility.
     
    Last edited: Mar 24, 2016