ProjectSend met Apache en Let’s Encrypt SSL installeren op Ubuntu 20.04
ProjectSend is een gratis en open-source toepassing voor het delen van bestanden en afbeeldingen, die je helpt bestanden te delen tussen je bedrijf en klanten. Het is een cliënt-georiënteerd programma voor het delen van bestanden waarmee je onbeperkte bestandsgrootte kunt uploaden en delen op elke server. Het is geschreven in PHP en gebruikt een MySQL database om de informatie op te slaan. Het biedt een rijke reeks functies, waaronder, Real-time statistieken, zelfregistratie, zelf aanmelden, aangepaste e-mail sjablonen, en meer.
In dit artikel laten we je zien hoe je de ProjectSend toepassing voor het delen van bestanden met Apache en Let’s Encrypt SSL installeert op Ubuntu 20.04.
Vereisten
- Een server met Ubuntu 20.04.
- Een geldige domeinnaam gericht met je server IP.
- Een root wachtwoord is op de server ingesteld.
Aan de slag
Werk eerst de systeempakketten bij naar de bijgewerkte versie door het volgende commando uit te voeren:
apt-get update -y
Als alle pakketten bijgewerkt zijn, kun je verder gaan met de volgende stap.
LAMP server installeren
Eerst moet je de Apache, MariaDB, PHP en andere vereiste uitbreidingen op je server installeren. Je kunt ze allemaal installeren met het volgende commando:
apt-get install apache2 mariadb-server imagemagick php libapache2-mod-php php-imagick php7.4-common php7.4-mysql php7.4-gd php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-bcmath php7.4-gmp
Nadat je alle pakketten geïnstalleerd hebt, bewerk je het php.ini bestand:
nano /etc/php/7.4/apache2/php.ini
Verander de volgende instellingen:
memory_limit = 512M upload_max_filesize = 32M max_execution_time = 300 date.timezone = Asia/Kolkata
Bewaar en sluit het bestand en herstart dan de Apache dienst om de veranderingen toe te passen:
systemctl restart apache2
Als je klaar bent, kun je verder gaan met de volgende stap.
Maak een databank voor ProjectSend
Vervolgens moet je een databank en gebruiker aanmaken voor ProjectSend.
Log daartoe in op de MariaDB met het volgende commando:
mysql
Eenmaal ingelogd maak je een databank en een gebruiker aan met het volgende commando:
MariaDB [(none)]> create database projectsend;
MariaDB [(none)]> create user projectsend@localhost identified by 'password';
Verleen vervolgens alle rechten aan de projectsend database met het volgende commando:
MariaDB [(none)]> grant all privileges on projectsend.* to projectsend@localhost;
Spoel vervolgens de privileges door en verlaat de MariaDB met het volgende commando:
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
Als je klaar bent, kun je verder gaan met de volgende stap.
ProjectSend downloaden
Vervolgens moet je de nieuwste versie van ProjectSend downloaden van zijn officiële website. Je kunt het downloaden met het volgende commando:
wget -O projectsend.zip https://www.projectsend.org/download/387/
Als de download voltooid is, pak je het gedownloade bestand uit met het volgende commando:
unzip projectsend.zip -d /var/www/html/projectsend
Verander vervolgens de directory in de uitgepakte directory en hernoem het standaard config bestand:
cd /var/www/html/projectsend/includes
cp sys.config.sample.php sys.config.php
Bewerk vervolgens het config bestand met het volgende commando:
nano sys.config.php
Verander de volgende instellingen:
define('DB_DRIVER', 'mysql'); /** Database name */ define('DB_NAME', 'projectsend'); /** Database host (in most cases it's localhost) */ define('DB_HOST', 'localhost'); /** Database username (must be assigned to the database) */ define('DB_USER', 'projectsend'); /** Database password */ define('DB_PASSWORD', 'password');
Bewaar en sluit het bestand en stel daarna de juiste toestemming en eigendom in met het volgende commando:
chown -R www-data:www-data /var/www/html/projectsend
chmod -R 775 /var/www/html/projectsend
chmod 644 /var/www/html/projectsend/includes/sys.config.php
Als je klaar bent, kun je verder gaan met de volgende stap.
Configureer Apache voor ProjectSend
Maak vervolgens een apache virtual host configuratiebestand aan met het volgende commando:
nano /etc/apache2/sites-available/projectsend.conf
Voeg de volgende regels toe:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/projectsend/ ServerName projectsend.example.com <Directory /var/www/html/projectsend/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/example.com-error_log CustomLog /var/log/apache2/example.com-access_log common </VirtualHost>
Sla het bestand op en sluit het af, schakel dan de herschrijfmodule en het virtuele host configuratiebestand in met het volgende commando:
a2enmod rewrite
a2ensite projectsend.conf
Herstart vervolgens de Apache dienst om de veranderingen toe te passen:
systemctl restart apache2
Je kunt nu de status van de Apache controleren met het volgende commando:
systemctl status apache2
Je zou de volgende uitvoer moeten zien:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2021-06-02 07:11:08 UTC; 5min ago Docs: https://httpd.apache.org/docs/2.4/ Process: 17680 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS) Main PID: 14862 (apache2) Tasks: 6 (limit: 2353) Memory: 25.0M CGroup: /system.slice/apache2.service ??14862 /usr/sbin/apache2 -k start ??17684 /usr/sbin/apache2 -k start ??17685 /usr/sbin/apache2 -k start ??17686 /usr/sbin/apache2 -k start ??17687 /usr/sbin/apache2 -k start ??17688 /usr/sbin/apache2 -k start Jun 02 07:11:08 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...
Toegang tot ProjectSend Web Interface
Open nu je webbrowser en ga naar de ProjectSend webinterface met de URL http://projectsend.example.com. Je zou de volgende pagina moeten zien:
Geef je site naam, site URL, admin gebruikersnaam, wachtwoord, en klik op de Install knop. Je zou de volgende pagina moeten zien:
Klik nu op de knop Login. Je zou de volgende pagina moeten zien:
Geef je admin gebruikersnaam, wachtwoord en klik op de Log in knop. Je zou nu het ProjectSend dashboard moeten zien op de volgende pagina:
Beveilig ProjectSend met Let’s Encrypt SSL
Het is altijd een goed idee om je website te beveiligen met Let’s Encrypt SSL. Eerst moet je het Certbot programma installeren om de SSL te installeren en te beheren. Het Certbot pakket zit standaard in de Ubuntu standaard repository, dus je kunt het installeren met het volgende commando:
apt-get install python3-certbot-apache -y
Als de Certbot geïnstalleerd is, voer je het volgende commando uit om je website met Let’s Encrypt SSL te beveiligen:
certbot --apache -d projectsend.example.com
Je wordt gevraagd je e-mail op te geven en de servicevoorwaarden te accepteren, zoals hieronder:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for projectsend.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/projectsend-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/projectsend-le-ssl.conf Enabling available site: /etc/apache2/sites-available/projectsend-le-ssl.conf
Kies vervolgens of je HTTP verkeer al dan niet naar HTTPS wilt omleiden, zoals hieronder:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Typ 2 en druk op Enter om de Let’s Encrypt SSL voor je website te installeren:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/projectsend.conf to ssl vhost in /etc/apache2/sites-available/projectsend-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://projectsend.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=projectsend.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/projectsend.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/projectsend.example.com/privkey.pem Your cert will expire on 2021-12-23. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Conclusie
Gefeliciteerd! Je hebt met succes ProjectSend met Apache en Let’s Encrypt SSL geïnstalleerd op Ubuntu 20.04. Je kunt nu gemakkelijk bestanden en afbeeldingen delen vanuit de ProjectSend webinterface.