The reason analysis and solution of the unknown error of Hipchat uploading file _nginx

Source: Internet
Author: User
Tags chrome developer hipchat

Hipchat functions like campfire, Sazneo, and other online collaborative tools, and is similar to Yammer and Salesforce's corporate social platforms. You can build your own chat rooms for individual projects or groups, and you can easily initiate one-on-one chats. The IM system also integrates team file management and sharing, dragging and dragging to complete the save operation.

Objective

Hipchat is a Atlassian company's team collaboration Instant Messaging tool, the server for Linux (the official server is a virtual machine), in Windows, Linux, Android, IOS, Mac and other platforms have client software, can also directly on the PC directly on the web chat, for teamwork and exchange needs of the collation of the comparison in place, the most important is hipchat can and confluence docking discussion topics (not confluence needs of individuals feel inferior to some other team communication software).

A few days ago to configure the Hipchat server task, but the use of a few days later found that when chatting to send more than 10M files will be an error:

Well, and gave a clear word of the error tip: When uploading files in error.

The official document says the limit is 50M. So there must be a problem here.

The final solution is given here first:

1. Log in to Linux and use the command below to get root permissions

Copy Code code as follows:

Sudo/bin/dont-blame-hipchat

2. Edit the configuration file:

Copy Code code as follows:

Vi/etc/nginx/includes/web-site

3. Find the following code fragment in approximately 120 lines, add and modify Client_max_body_size 1024m; (10M)

Copy Code code as follows:

# Coral Requests
Location/v2 {
# Allow larger requests for import
Location ~/v2/import/(. *) {
Client_max_body_size 1024m;
Rewrite ^/v2/(. *) $/$1 break;
Proxy_pass http://coral_servers;
}
# All other Coral calls
Client_max_body_size 1024m;
Rewrite ^/v2/(. *) $/$1 break;
Proxy_pass http://coral_servers;
}

4. Execute overloaded parameter File command:

Copy Code code as follows:

/opt/nginx-1.4.2/sbin/nginx-s Reload

You can try to modify other client_max_body_size parameters in the file if the modification is complete.

If not, then it may be the official version of the change caused some file location changes, you can refer to my later troubleshooting process.

Below is a description of my problem-solving mentality.

1. Determine the type of Web server

The problem with uploading files is found on the Windows desktop version of the Hipchat, but because of the same effect as the browser access, I guess the back must be a Web server, so open the browser to try to send files in the chat interface, it is the same error, but the difference is, I can use the modern browser debugging tools to view the requested error content, so I see:

Point in to see:

See Nginx, no contact with Nginx, but now a lot of network information, it is easy to find the relevant information.

(Note: I'm using the Chrome Developer tool here.)

2. Find and modify configuration files

It's easy to find Nginx is a proxy, and the Client_max_body_size field in its configuration file indicates the maximum upload size. So now log on to the server

1. Log in to Linux and use the command below to get root permissions

Copy Code code as follows:

Sudo/bin/dont-blame-hipchat

2. Find the Nginx configuration file with the command:

Copy Code code as follows:

Find/-name ' nginx.conf '

The results are as follows:

Copy Code code as follows:

/opt/atlassian/hipchat/dependencies/source/nginx-1.4.2/conf/nginx.conf
/hipchat-scm/web/application/vendor/elastica/test/nginx/nginx.conf
/etc/nginx/conf.d/nginx.conf
/etc/nginx/nginx.conf
/usr/local/src/nginx-1.4.2/conf/nginx.conf

3. Edit configuration file

Copy Code code as follows:

Vi/etc/nginx/nginx.conf

The changes are as follows:

Copy Code code as follows:

User Www-data;
Worker_processes 4;
Daemon off;
Error_log/var/log/nginx/error.log;
Pid/var/run/nginx.pid;
Events {
Worker_connections 2048;
}
HTTP {
Include/etc/nginx/mime.types;
Default_type Application/octet-stream;
Log_format Custom ' $remote _addr-$remote _user [$time _local] '
' $request ' $status $body _bytes_sent '
"$http _referer" "$http _user_agent"
' $http _x_forwarded_for ' $http _x_forwarded_proto ';
Access_log/var/log/nginx/access.log Custom;
Server_tokens off;
Sendfile on;
Tcp_nopush on;
Tcp_nodelay on;
Keepalive_timeout 65;
Client_max_body_size 1024m;
gzip on;
Gzip_http_version 1.0;
Gzip_comp_level 2;
Gzip_proxied any;
Gzip_types text/plain text/css application/x-javascript text/xml application/xml;
Proxy_buffers 8 16k;
Proxy_buffer_size 16k;
Server_names_hash_bucket_size 64;
include/etc/nginx/conf.d/*.conf;
include/etc/nginx/sites-enabled/*;
}

4. Execute overloaded parameter File command:

Copy Code code as follows:

/opt/nginx-1.4.2/sbin/nginx-s Reload

Discovery did not solve the problem, restart the Linux virtual machine, still did not solve the problem, and after the reboot found that the configuration file Client_max_body_size was changed back to 10m. Then again from how to restart after the configuration file does not reset parameters to start, the actual proof of this idea is wrong.

There are two include statements at the bottom of the configuration file, and the/etc/nginx/conf.d/directory is empty, and then enters the/etc/nginx/sites-enabled directory. Found a link file inside.

So look at the file/etc/nginx/sites-available/000-web. Discover that the bottom is also a include file:

... ...

Copy Code code as follows:

server {
Listen default_server;
More_clear_input_headers ' X-hipchat-group ';
More_clear_input_headers ' X-hipchat-user ';
Add_header strict-transport-security "max-age=31536000";
More_clear_input_headers ' x-hipchat-request ';
More_set_input_headers ' X-hipchat-request:public ';
Include Includes/web-site;
}

And then find Includes/web-site:

5. Open the Web-site file, find the client_max_body_size in it, and finally find that 120 rows of attachment Location/v2 add client_max_body_size configuration entries in effect.

Copy Code code as follows:

# Coral Requests
Location/v2 {
# Allow larger requests for import
Location ~/v2/import/(. *) {
Client_max_body_size 1024m;
Rewrite ^/v2/(. *) $/$1 break;
Proxy_pass http://coral_servers;
}
# All other Coral calls
Client_max_body_size 1024m;
Rewrite ^/v2/(. *) $/$1 break;
Proxy_pass http://coral_servers;
}

6. After the save, execute the following command to reload the configuration file.

Copy Code code as follows:

/opt/nginx-1.4.2/sbin/nginx-s Reload

(Note: The Nginx path may be changed, if it cannot be done, find another Nginx directory).

3. Summary

After such a reform, hipchat can upload more than 50M files, of course, 50M is not small, but this is an official limit, it is estimated that only to the official feedback or pay to solve the problem.

In fact, when using Hipchat I was a bit confused about the status of Hipchat in Atlassian company, because there are many problems. In addition to this encounter, there are windows, Linux, Mac, IOS, Android and other platforms of the client version is older, Windows can not send maps and files, Android directly not even on the end is directly from the official website to download the latest client package to solve the problem, Other platforms have not been tried. (Android version needs to be installed at Google Play store).

Hipchat is a niche software, so no one is expected to encounter this problem. In addition to documenting the problem, this article provides a way to solve the problem. The problem with this type of network connection class, and neither the server nor the client can see the source code, could be solved like this. You can use tools such as Wireshark to find problems even if the server is not an HTTP server.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.