====== Send - Partage de fichier ====== Voici un autre logiciel, plus simple que [[serveur_hebergement:zendto_-_partage_de_fichiers|Zendto]] pour partager des fichiers : [[https://github.com/timvisee/send|Send]]. Pas de compte, pas d'envoi de mail. ===== Pré-requis ===== Pour faire tourner Send, il vous faut un serveur web (Apache2 dans mon cas), git, nodejs et npm. Pour installer tout ça sous Debian : sudo aptitude install git apache2 nodejs npm Je ne traiterai pas la configuration générale d’Apache2 ici. ===== Installation ===== Rendez-vous dans le répertoire /var/www : cd /var/www Récupérez les sources (on va utiliser l'utilisateur www-data pour toutes les commandes) : sudo -u www-data git clone https://github.com/timvisee/send.git Rendez-vous dans le répertoire send créé : cd send Lancez l'installation : sudo -u www-data npm install sudo -u www-data npm run build Ouvrez le fichier de configuration : sudo nano /var/www/send/server/config.js Remplacez la ligne default: 'https://send.example.com', par default: 'https://partage.domaine.fr', ===== Configuration d’Apache2 ===== On va créer un fichier de configuration afin de pouvoir accéder à Send via un sous-domaine partage.domaine.fr (ou autre sous-domaine selon votre convenance). Créez le fichier de configuration partage.domaine.fr.conf dans /etc/apache2/sites-available (remplacez domaine.fr par votre domaine) et collez-y les lignes suivantes en adaptant le domaine et l'emplacement des fichiers SSL : ServerName partage.domaine.fr Redirect / https://partage.domaine.fr/ ServerName partage.domaine.fr LogLevel warn CustomLog ${APACHE_LOG_DIR}/partage.access.log combined ErrorLog ${APACHE_LOG_DIR}/partage.error.log SSLEngine on SSLCertificateFile /etc/letsencrypt/live/domaine.fr/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/domaine.fr/privkey.pem Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self'; media-src 'self'; child-src 'self'; object-src 'self'; form-action 'self'; img-src 'self' * data:" RewriteEngine on # Make sure the original domain name is forwarded to Send # Otherwise the generated URLs will be wrong ProxyPreserveHost on # Make sure the generated URL is https:// RequestHeader set X-Forwarded-Proto https # If it's a normal file (e.g. PNG, CSS) just return it RewriteCond %{REQUEST_FILENAME} -f RewriteRule .* - [L] # If it's a websocket connection, redirect it to a Send WS connection RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /(.*) ws://127.0.0.1:1443/$1 [P,L] # Otherwise redirect it to a normal HTTP connection RewriteRule ^/(.*)$ http://127.0.0.1:1443/$1 [P,QSA] ProxyPassReverse "/" "http://127.0.0.1:1443" Activez les modules d'Apache2 nécessaires : sudo a2enmod headers proxy proxy_http proxy_wstunnel rewrite Activez le fichier de configuration : sudo a2ensite partage.domaine.fr Puis rechargez Apache2 : sudo systemctl reload apache2 ===== Lancement de Send via Systemd ===== Créez le fichier /etc/systemd/system/send.service Copiez les lignes suivantes dedans [Unit] Description=Send - Partage de fichier [Service] WorkingDirectory=/var/www/send/ ExecStart=npm run prod User=www-data [Install] WantedBy=multi-user.target Activez le service au démarrage sudo systemctl enable send.service Démarrez le service sudo systemctl start send.service Vous pouvez maintenant accéder à Send à l'adresse partage.domaine.fr