ProjectSend is a free and open-source file and image sharing application that helps you to share files between your company and clients. It is a client-oriented file sharing tool that allows you to upload and share unlimited file size on any server. It is written in PHP and uses a MySQL database to store the information. It offers a rich set of features including, Real-time statistics, self-registration, self login, Custom E-mail templates, and more.
In this post, we will show you how to install the ProjectSend file sharing application with Apache and Let's Encrypt SSL on Ubuntu 20.04.
Prerequisites
- A server running Ubuntu 20.04.
- A valid domain name pointed with your server IP.
- A root password is configured on the server.
Getting Started
First, update the system packages to the updated version by running the following command:
apt-get update -y
Once all the packages are updated, you can proceed to the next step.
Install LAMP Server
First, you will need to install the Apache, MariaDB, PHP and other required extensions to your server. You can install all of them with the following command:
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
After installing all packages, edit the php.ini file:
nano /etc/php/7.4/apache2/php.ini
Change the following settings:
memory_limit = 512M upload_max_filesize = 32M max_execution_time = 300 date.timezone = Asia/Kolkata
Save and close the file then restart the Apache service to apply the changes:
systemctl restart apache2
Once you are finished, you can proceed to the next step.
Create a Database for ProjectSend
Next, you will need to create a database and user for ProjectSend.
To do so, log in to the MariaDB with the following command:
mysql
Once login, create a database and user with the following command:
MariaDB [(none)]> create database projectsend;
MariaDB [(none)]> create user projectsend@localhost identified by 'password';
Next, grant all the privileges to the projectsend database with the following command:
MariaDB [(none)]> grant all privileges on projectsend.* to projectsend@localhost;
Next, flush the privileges and exit from the MariaDB with the following command:
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
Once you are finished, you can proceed to the next step.
Download ProjectSend
Next, you will need to download the latest version of ProjectSend from its official website. You can download it with the following command:
wget -O projectsend.zip https://www.projectsend.org/download/387/
Once the download is completed, extract the downloaded file with the following command:
unzip projectsend.zip -d /var/www/html/projectsend
Next, change the directory to the extracted directory and rename the default config file:
cd /var/www/html/projectsend/includes
cp sys.config.sample.php sys.config.php
Next, edit the config file with the following command:
nano sys.config.php
Change the following settings:
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');
Save and close the file then set proper permission and ownership with the following command:
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
Once you are finished, you can proceed to the next step.
Configure Apache for ProjectSend
Next, create an apache virtual host configuration file with the following command:
nano /etc/apache2/sites-available/projectsend.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin admin@example.com 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>
Save and close the file then enable the rewrite module and virtual host configuration file with the following command:
a2enmod rewrite
a2ensite projectsend.conf
Next, restart the Apache service to apply the changes:
systemctl restart apache2
You can now check the status of the Apache with the following command:
systemctl status apache2
You should see the following output:
? 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...
Access ProjectSend Web Interface
Now, open your web browser and access the ProjectSend web interface using the URL http://projectsend.example.com. You should see the following page:
Provide your site name, site URL, admin username, password, and click on the Install button. You should see the following page:
Now, click on the Login button. You should see the following page:
Provide your admin username, password and click on the Log in button. You should see the ProjectSend dashboard on the following page:
Secure ProjectSend with Let's Encrypt SSL
It is always a good idea to secure your website with Let's Encrypt SSL. First, you will need to install the Certbot client to install and manage the SSL. By default, the Certbot package is included in the Ubuntu default repository so you can install it with the following command:
apt-get install python3-certbot-apache -y
Once the Certbot is installed, run the following command to secure your website with Let's Encrypt SSL:
certbot --apache -d projectsend.example.com
You will be asked to provide your email and accept the term of service as shown below:
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): hitjethva1981@gmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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
Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:
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
Type 2 and hit Enter to install the Let's Encrypt SSL for your website:
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
Conclusion
Congratulations! you have successfully installed ProjectSend with Apache and Let's Encrypt SSL on Ubuntu 20.04. You can now easily share files and images from the ProjectSend web interface.