server { listen 80; server_name your-domain.com; location /audio/ { alias /path/to/your/audio/files/; if ($request_filename ~* \.mp3$) { add_header Content-Disposition "attachment"; add_header Content-Type "audio/mpeg"; } add_header Access-Control-Allow-Origin "*"; } }