Use the get parameter in nginx to specify the configuration for saving the downloaded file name.
Source: Internet
Author: User
After the resource file is uploaded, the file name is changed to a meaningless character segment to avoid file name conflicts. This character may be generated by MD5 or a string generated by other methods. At this time, when downloading, the default file name saved will be this meaningless file... information & n after we upload the resource file, we will change the file name to a meaningless character to avoid file name conflict. This character may be generated by MD5 or a string generated by other methods. At this time, the default file name saved during the download will be the meaningless file name (). In fact, nginx supports renaming during download to make the file name more friendly. Nginx is also easy to configure: just add the following lines: 1 location ~ *. * \. (Doc | txt | jar | zip | apk )(\?. *)? $2 {3 if ($ request_uri ~ * ^. * \/(. *) \. (Doc | txt | jar | zip | apk )(\? N = ([^ &] +) $) {4 add_header Content-Disposition "attachment; filename = $ arg_n. $2 "; 5} 6 log_not_found off; 7 expires 30d; 8 break; 9} the red part is critical. this configuration ensures that the original name is saved if n parameter is not input. No empty name is displayed. Because this header is specified in the form of a header, cdn will save this header information, which will also be the same during content delivery. Apache cannot read the get parameter, so the configuration fails. You cannot use apache as the file server. if anyone knows that apache can be configured, please let us know. thank you.
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