WARNING: this guide is not about security, but about functionality, for example, never run applications as root. Be cautious.
sudo su
add-apt-repository ppa:qbittorrent-team/qbittorrent-stable && \
apt install -y qbittorrent qbittorrent-nox
| server { | |
| listen 80; | |
| server_name default_server; | |
| location ~ ^.*/(?P<request_basename>[^/]+\.(csv))$ { | |
| root /www/data/; | |
| add_header Content-Disposition 'attachment; filename="$request_basename"'; | |
| } | |
| } |
mainly used in start-up script
When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.
How to:
- Enable reboot via SMS.
- Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.
| Okay so here's the setup: | |
| [-] The primary server API is exposed via Flask (Python) and all static files, including all html, css, js is served by nginx. | |
| [-] Python is exposing an API at url http://domain.com/api/download/<file_id>, where file_id is a database id for the file that we're interested in downloading. | |
| 1. User wants to download a file, so we spawn a new window with the url '/api/download/<file_id>' | |
| 2. Nginx intercepts the request, sees that it starts with /api/, and then forwards the request to Flask, which is being served on port 5000. | |
| 3. Flask routes the request to its download method, retrieves the pertinent data from the file_id, and constructs additional header settings to make nginx happy and to force the browser to see the file stream as a download request instead of the browser just trying to open the file in a new window. Flask then returns the modified header stream to nginx | |
| 4. Nginx is finally ready to do some work. While parsing the headers for the incoming request, it encounters "X |