• Resolved bradbpw

    (@bradbpw)


    I am attempting to upload a few PDF files that are over 1mb (1.25mb and 6.3mb) and I get the “HTTP Error” warning. I have been able to upload several files that are less than 1mb.

    My max upload size is set to 250mb in my php settings

    Any idea how to fix this?

Viewing 15 replies - 16 through 30 (of 32 total)
  • Thread Starter bradbpw

    (@bradbpw)

    ClaytonJames, yes, we are using nginx as a front end proxy for apache.

    I’m just thinking out loud here, so I’m going to be right up front about this and let you know that we’re now wading in water that’s rapidly rising above my head; but maybe this will point you in a productive direction.

    My (vague) understanding is that when ‘client_max_body_size’ is not declared in an nginx configuration, the max upload size defaults to 1MB. I have no idea how, or even if that might possibly be contributing to your issue, but it might be worth some investigation.

    HTTP 413 errors, the 1MB limitation, and the nginx ‘client_max_body_size’ seem to share some indicators with your symptoms, and the fact that you’re using nginx to proxy apache, makes me think it wouldn’t be an unreasonable avenue of exploration.

    Thread Starter bradbpw

    (@bradbpw)

    I made the changes to the Nginx config using this
    https://rtcamp.com/tutorials/php/increase-file-upload-size-limit/

    Didn’t fix it.

    This may help, I found an error code by inspecting the page after the error

    Failed to load resource: the server responded with a status of 403 (Forbidden)

    My wordpress/wp-content/uploads has full permissions

    drwxrwxrwx 4 www-data www-data 4096 Feb 4 21:30 uploads

    I’m out of guesses on this one.. completely mystified as to why files under 1MB don’t cause any issue.

    This is the point where you need to find some professional help for your problem.

    As much as we’d all love to help, this is something that’s really past what anyone here can offer (unless a real server admin can respond, but the chances of that on here are not as high as I’d like sometimes). As I’m sure you’re aware, the configuration options for servers are very complicated and something that changes from box to box. With that level of complexity an online forum can only offer these sort of suggestions, and that’s about it.

    Thread Starter bradbpw

    (@bradbpw)

    Ok, I appreciate the help.

    I’m inclined to think it is a wordpress issue. I have an owncloud installation on this same server using the same Nginx to Apache proxy, and I can upload huge files to it.

    Thanks guys! I’ll report back if I get it fixed.

    Check inside your uploads directory– remember, you’re not placing file there, but in a sub-folder. Assuming you’re doing this today and you have it set to organize media by date, you’d want to check uploads/2014/02/ and see what it has set.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Do you have access to the server error.log files (both nginx and apache)? Might be handy to see what errors are being output there when you try to upload a big file.

    Thread Starter bradbpw

    (@bradbpw)

    As far as permissions, my uploads/2014/02 has full permissions.

    There weren’t any entries in the apache log file, but nginx had this:

    xxx.xxx.xx.xxx – – [11/Feb/2014:17:16:38 -0600] “POST /wp-admin/admin-ajax.php HTTP/1.1” 200 26 “https://ap.bpwgroup.com/wp-admin/media-new.php” “Mozilla/5.$
    xxx.xxx.xx.xxx – – [11/Feb/2014:17:16:51 -0600] “POST /wp-admin/async-upload.php HTTP/1.1” 413 601 “https://ap.bpwgroup.com/wp-admin/media-new.php” “Mozilla$

    In your nginx error log you have a 413 error.

    I just checked my main nginx.conf and there is a directive called client_max_body_size.

    I’m not certain this is the cause but if you look the directive up on the nginx wiki it says “If the stated content length is greater than this size, then the client receives the HTTP error code 413”

    The default is 1M. Perhaps try raising that and restarting nginx to see if that makes a difference.

    https://wiki.nginx.org/HttpCoreModule

    Oh, I also found this which makes the above solution look even more promising ??

    https://blog.rezajp.info/posts/maximum-upload-size-in-wordpress-running-on-nginx/

    Thread Starter bradbpw

    (@bradbpw)

    I followed that link to make the changes and it did not fix it.

    I added this to /etc/nginx/sites-enabled/default

    server {
    listen 81; ## listen for ipv4; this line is default and implied
    #listen [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www;
    index index.html index.htm;

    # Make site accessible from https://localhost/
    server_name localhost;
    client_max_body_size 100M;

    I added this to /wordpress/wp-config.php

    // ** MySQL settings – You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘wordpress’);

    /** MySQL database username */
    define(‘DB_USER’, ‘root’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘jb*1978*’);

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    /** Database Charset to use in creating database tables. */
    define(‘DB_CHARSET’, ‘utf8’);

    /** The Database Collate type. Don’t change this if in doubt. */
    define(‘DB_COLLATE’, ”);

    /** Increase limit for uploads. */
    define(‘WP_MEMORY_LIMIT’, ‘100M’);

    My upload max size at /etc/php5/cgi/php.ini has always been this

    ; Maximum allowed size for uploaded files.
    ; https://php.net/upload-max-filesize
    upload_max_filesize = 250mb

    Thread Starter bradbpw

    (@bradbpw)

    I checked the log again and now it is a different code, it is 403

    xxx.xxx.xx.xxx – – [11/Feb/2014:18:13:21 -0600] “GET /favicon.ico HTTP/1.1” 200 0 “-” “Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like $
    xxx.xxx.xx.xxx – – [11/Feb/2014:18:13:41 -0600] “POST /wp-admin/async-upload.php HTTP/1.1” 403 1394 “https://ap.bpwgroup.com/wp-admin/media-new.php” “Mozill$

    A 403 would suggest a file/folder permission issue.

    By the way have you made sure to reboot the server or restart php and/or nginx (whichever is easiest) each time you update your configs?

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘Can't upload files over 1mb – HTTP Error’ is closed to new replies.