1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

nginx upload and inline thread edit problems

Discussion in 'Server Configuration and Hosting' started by gldtn, Apr 3, 2012.

  1. gldtn

    gldtn Well-Known Member

    Hello guys, I have nginx and php-fpm installed, but I'm getting a couple of error.

    1. No matter what size I set the limit of attachments to on the ACP, I can't seem to upload anything larger than 10MB. Depending on the limit I set to it stops and gives me error saying their was a problem with my upload. If I set the size to maximum amount that xenforo allows, it uploads to about 77% and it hangs. When I hit cancel I get the same error saying simply that there was a problem trying to upload the file.

    2. When I try to do an inline edit of a thread I get a gateway problem: http://cl.ly/0E1K1L0D1k122f3H1q19

    After refreshing the thread list page you can see that changes you made normally.

    You help is appreciated, thanks!
     
  2. Adam Howard

    Adam Howard Well-Known Member

    You can start by upgrading your copy of nginx

    nginx 1.0.6 is almost a year old and had a few bugs

    1)

    “client_max_body_size” while you set up the sever, you might encounter “IO error” if you want to upload file that’s over the upload limit.

    So, how do you make the change to increase or decrease the file upload limit? You have to modify 3 settings:
    • Edit “nginx.conf “. Find “client_max_body_size” and change the value to the one you want.
    • Edit “php.ini”. Find “post_max_size” and “upload_max_filesize” and change the values;
    • Restart nginx and php (done)
    2)
    Upgrading Nginx may correct your error (recall an older version of nginx had such a repeating error)
     
    gldtn likes this.
  3. gldtn

    gldtn Well-Known Member

    I don't see any "client_max_body_size"in my config:

    Code:
    user  nobody;
    # no need for more workers in the proxy mode
    worker_processes  1;
    error_log  /var/log/nginx/error.log info;
    worker_rlimit_nofile  65535;
    events {
    worker_connections  8192; # increase for busier servers
    use epoll; # you should use epoll here for Linux kernels 2.6.x
    }
    http {
    server_names_hash_max_size 2048;
    server_names_hash_bucket_size 128;
    include    mime.types;
    default_type  application/octet-stream;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout  10;
    gzip on;
    gzip_min_length  1100;
    gzip_buffers  4 32k;
    gzip_types    text/plain application/x-javascript text/xml text/css;
    ignore_invalid_headers on;
    client_header_timeout  3m;
    client_body_timeout 3m;
    send_timeout    3m;
    connection_pool_size  256;
    client_header_buffer_size 4k;
    large_client_header_buffers 4 32k;
    request_pool_size  4k;
    output_buffers  4 32k;
    postpone_output  1460;
    # only works on dev version  open_log_file_cache max=8000 inactive=20s min_uses=2 valid=1m;
    log_format bytes_log "$msec $bytes_sent .";
    include "/etc/nginx/vhosts/*";
    }
    
    Also what is the recomended size?
     
  4. Liam D.

    Liam D. Active Member

    In php.ini, post_max_size should be greater than or equal to the value of upload_max_filesize. Pretty obvious enough, upload_max_filesize is the maximum filesize (in MB) of a file that is allowed to be uploaded. post_max_size is the maximum size of POSTDATA to be accepted into the server. post_max_size should NEVER be lower than the value of upload_max_filesize.

    Also, try increasing the values of max_execution_time and max_input_time in php.ini. After changes, do an /etc/init.d/php-fpm restart to reload the changes in php.ini, and then do an /etc/init.d/nginx restart to restart the NginX process threads.

    That should work, at least it does for me.
     
    gldtn likes this.
  5. Adam Howard

    Adam Howard Well-Known Member

    Add it under postpone_output 1460;

    You should have the value the same as whatever value you plan on using for php.ini

    Liam D. also adds some good advice.
     
    Liam D. and gldtn like this.
  6. gldtn

    gldtn Well-Known Member

    Thanks guys, I'll add these in once I get home tonight and report back. As far as the gateway problem it seems something related to the "add-on" which only uses some template changes and it only happens when editing a thread that uses my add-on template changes and not on the normal Xenforo thread list :confused:

    I've upgraded my Nginx through yum since I'm on CentOS and it points to Nginx 1.0.14 now.
     
    TheVisitors likes this.
  7. SneakyDave

    SneakyDave Well-Known Member

    What repository are you using to get those more current versions on Nginx on CentOS? My base CentOS (5.8 32bit) repositories list version 0.8.55 as the latest.

    Are you using the "official" nginx CentOS repository?
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=0
    enabled=1
     
  8. shawn

    shawn Well-Known Member

    Use the nginx repo.

    I went through all the same problems you're describing. Increased client_body_buffer_size and client_max_body_size to keep nginx from buffering to disc, and that seemed to fix it. However, something was still breaking XenForo's multiple file uploader. I scrapped all of it and went back to an nginx/apache combination. My ram use is lower and page speed is basically the same. Apache "feels" slower because it takes a beat, then everything appears at once. PHP-FPM starts generating the page immediately, but it's like an interlaced gif. It takes a second for all the pieces to finish appearing. Total start-finish rendering time is close enough not to matter.
     
    gldtn likes this.
  9. gldtn

    gldtn Well-Known Member

    Yes, I created a file in /etc/yum.repos.d/nginx.repo and placed that same exact code in it:
    Code:
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=0
    enabled=1
    I think you meant /etc/init.d/nginx restart ;) just in case someone is following along!

    The big file uploads are now working, just need to figure out why the bad gateway problem :/
     
  10. Liam D.

    Liam D. Active Member

    LOL. Thanks for pointing that out. Had a lot running through my mind.

    For the bad gateway issue, I assume you're using php-fpm, right? Try restarting the php-fpm service and that might solve it. You might need to increase RAM or CPU, since php-fpm does that everytime. How much RAM do you have?
     

Share This Page