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
278
61
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
 
Solution
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;
}

Pedro

Forum Admin
Staff member
Trusted Uploader
Contributor
Aug 21, 2021
1,674
3
2,532
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:
Solution

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)