Issues with no access to the Tomcat 8.5 version file after uploading

Source: Internet
Author: User

http://blog.csdn.net/myo_o1/article/details/64131124

Before the file upload after the Tomcat 7 access has been no problem, now the Tomcat version rose to 8.5, in the test file HTTP upload, found that the file can not be accessed through Nginx. (Tomcat specific version is 8.5.11)

The Ps:tomcat is started by the root user.

After determining the Nginx itself has no configuration problem, on the Linux server to view the file, found that its upload directory code automatically created by the directory permissions is 750, the uploaded file permission is 640. This means that the permissions that are granted by default to other users in the file permissions are always 0.

The default permissions are related to Umask, so it is suspected that the system defaults, but after viewing the system default configuration (/etc/profile), it is not a problem to find the default configuration.

Umask 002 corresponds to file permissions 664, folder permissions 775;umask 022 for file Permissions 644, folder permissions 755. Can be seen with read access. By default, Tomcat's directories and files should use Umask 022, but why is this not the case?

(according to the results, the default permissions for files uploaded under Tomcat 8.5 are umask 027)

The problem here, it is not possible to exclude a lot of reasons, because before the use of Tomcat 7 on other machines is the upload after the access is not a problem, so the Tomcat 7 on this server tested, to determine whether Tomcat 8.5 itself problem. The result is that Tomcat 7 on the same server has no problem accessing it after uploading. The final location for the title is on Tomcat 8.5.

Next, with a try-and-try mentality, search for the Umask keyword in tomcat 8.5 's catalina.sh (because I always have an intuition about this and the default permission settings, the results confirm that this judgment is accurate), fortunately, the reason is immediately positioned.

Umask= "0027" appeared! After changing to umask= "0022" and restarting Tomcat 8.5, after the current functional requirements, the file upload access is restored to normal.

At this point, the problem is resolved. During the period, did not want to solve the problem through Baidu or Google, but because the Tomcat 8.5 version of the newer, related issues in the Chinese language documents have not been searched. The English document also found traces in the Tomcat website document and related English forums after searching for the keyword tomcat8.5 umask after locating the Tomcat 8.5 issue.

Issues with no access to the Tomcat 8.5 version file after uploading

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.