A list of available API calls can be found over at Postman.
Set up a new directory for TempFiles
mkdir /opt/tempfiles
cd /opt/tempfiles
Copy the resource files. Set up a virtual server config for nginx to use.
mkdir resources
curl https://raw.githubusercontent.com/Carlgo11/TempFiles-backend/master/resources/nginx.conf > nginx.conf
curl https://raw.githubusercontent.com/Carlgo11/TempFiles-backend/master/resources/php.ini > php.ini
Create a docker-compose.yml file.
nano docker-compose.yml
And paste in the following:
version: '3.2'
services:
tmpfiles:
image: carlgo11/tempfiles-backend
ports:
- "5392:5392"
- "5393:5393"
volumes:
- ./resources/nginx.conf:/opt/docker/etc/nginx/vhost.conf:ro
- ./resources/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
restart: always
Set up a second webserver as a reverse proxy for the docker container(s).
This can be done with Apache or Nginx. Here's an example config for Nginx:
# API
server {
listen 443 ssl http2;
server_name api.tempfiles.download;
ssl_certificate <certificate path>;
ssl_certificate_key <certificate key path>;
ssl_ciphers 'CDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
# 100M = Total file upload limit of 100 MegaBytes.
client_body_buffer_size 128M;
client_max_body_size 128M;
location / {
proxy_pass http://127.0.0.1:5392;
}
}
# Download
server {
listen 443 ssl http2;
server_name d.tempfiles.download;
ssl_certificate <certificate path>;
ssl_certificate_key <certificate key path>;
ssl_ciphers 'CDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
location / {
proxy_pass http://127.0.0.1:5393;
}
}
Run the container
docker-compose up -d
Installation can also be done without using Docker.
Here's how to set up TempFiles-Backend directly on a Linux server:
Install PHP, Nginx, Git, Composer
sudo apt update
sudo apt upgrade
sudo apt install nginx php php-fpm composer php-curl php-mbstring git
Download the source code
git clone https://github.com/Carlgo11/Tempfiles-backend.git
cd Tempfiles-backend/
Download dependencies
composer install --no-dev
Set file path
nano src/com/carlgo11/tempfiles/config.php
Change 'file-path' to a suitable directory and create said directory.
mkdir /tempfiles # file path directory
chown www-data:www-data /tempfiles -R
chmod 0700 /tempfiles -R
Copy the Nginx configurations to the sites-available directory.
cp ./ressouces/nginx/*.conf > /etc/nginx/sites-available/
Generate certificates.
For HTTPS to work you'll need a certificate. Due to the many different certificate companies and their different ways of generating certificates I won't go into that in this text.
When you have a certificate, change the following lines in both nginx configs:
nano /etc/nginx/sites-available/*.conf
ssl_certificate {path_to_cert}/cert.pem; #Change path
ssl_certificate_key {path_to_key}/privkey.pem; #Change path
Restart Nginx
sudo systemctl restart nginx
| Name | Default Value | Type | Description |
|---|---|---|---|
| TMP_PATH | /tmp/tempfiles | String | Path where encrypted files should be saved to |
| TMP_MAX_SIZE | 128M | String | Max file size |
| TMP_ENCRYPTION_ALGO | aes-256-gcm | String | File encryption algorithm |
| TMP_STORAGE_METHOD | File | String | Storage method. Available methods are: File, MySQL |
| TMP_HASH_COST | 10 | Integer | Bcrypt hashing cost. Only used for hashing deletion password. |
| TMP_DOWNLOAD_URL | https://d.carlgo11.com/%1$$s/?p=%2$$s | String | URL where the user can download the file. %1$$s=ID %2$$s=Password |
| TMP_404_URL | https://tempfiles.download/download/?404=1 | String | URL to redirect to if a file can't be downloaded. |
Content type
Image
Digest
Size
164.5 MB
Last updated
about 6 years ago
docker pull carlgo11/tempfiles-backend