Web Analytics
How can I Auto download Mp3 on nginx server - StoreFront Forums

How can I Auto download Mp3 on nginx server

Streetot

Active member
Contributor
Sep 6, 2021
136
45
28
streetott.com.ng
My Mp3 files is playing instead of downloading and I have use this code

#forcemp3
<FilesMatch "\.(zip|mp3|mp4|wav|pdf)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch> But not working
 

Pedro

Forum Admin
Staff member
Trusted Uploader
Contributor
Aug 21, 2021
1,458
2
2,312
113
Genesis Forum
storefront.com.ng
Nginx doesn't support .htaccess. The code you provided requires .htaccess.

What you should do is to convert the .htaccess code and add it to nginx.conf, commonly found at /etc/nginx/nginx.conf or /etc/nginx/sites-available/default or a similar location depending on your server setup).

Example

NGINX:
location ~* \.(zip|mp3|mp4|wav|pdf)$ {
    add_header Content-Disposition "attachment";
    default_type application/octet-stream;
}
 
Last edited:

New Posts

Forum statistics

Threads
856
Messages
5,296
Members
2,819
Latest member
nicekid
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock    No Thanks