This documents contains instructions for installing the server side code on cPanel or a standard LAMP appliance from any reputed cloud service provider.
Keep in mind
The server steps assume you have a clean Ubuntu server running LAMP already with root (SSH) access to it (LAMP/LEMP only, not applicable to cPanel install).
You web server runs under www-data user (LAMP/LEMP only, not applicable to cPanel install).
You have pointed your domain e.g., yourapp.com to your server IP address (via A record at your domain registrar). Throughout these steps, I will use yourapp.com as a placeholder for your website address that you must replace with yours.
Below instructions assume that you are familiar with command line and cloud deployments. The steps are inclined towards standard LAMP distribution offered by DigitalOceanhere. These would not differ much for any other LAMP distribution on Ubuntu or other Debian derived distros. For LEMP, only the virtual host configuration may differ and rest steps can be easily adapted.
Before getting started, upload the server.zip archive to your server using below command:
Then SSH into the server and proceed with installing dependencies.
sshroot@yourapp.com
# update index with latest packagessudoaptupdate# required to extract the uploaded archivesudoaptinstallunzip# the extensions that do not come by defaultsudoaptinstallphp-bcmathphp-curlphp-mbstringphp-redisphp-xml# needed for sending forgot password emails (optional)sudoaptinstallsendmail# needed for background job processing (optional)sudoaptinstallredis-serversupervisor# needed for uploading clips from admin panel (optional)sudoaptinstallffmpeg
Now you can extract the uploaded ZIP archive and setup file/folder permissions.
Now create a copy of apache's default vhost for our app.
Then we must update the vhost configuration similar to below example. Being specific, you need to add a ServerName directive to match your domain e.g., yourapp.com. You need to suffix DocumentRoot with /public_html and do similar with the <Directory .../> directive as well.
Then you must disable the default vhost, enable your created vhost and enable the rewrite module of apache2. Please run below commands to achieve it.
Some PHP (assuming version 7.4, replace with yours) settings must also be tweaked to allow bigger uploads (and mostly on slower connections).
Then find and update below options as shown. You can use Ctrl+W to quickly locate them.
Then restart the apache server as below:
It is not required to have SSL certificate but recommended to have secure your users personal data from MITM and similar attacks. You can also get a free SSL certificate using below command:
You also need to create a MySQL database and an associated user to use with the script. You can run below commands to create those but please make sure to replace 12345678 with a strong password and make note of it for use later.
You should now open https://yourapp.com/ in your favorite browser, provide all the required information and return here when the installation is done.
You must also setup a cron job to automatically send scheduled notifications (recommended) and update news articles (if needed). To do that, please follow below commands:
If you wish to use background job queue (highly recommended), you must also configure a process manager for your queue workers. To do that, run below command:
Put below contents in the file and save.
Then restart the Supervisor as follows:
The server has now been setup and you can proceed to building the Android app.
# change to server's document root
cd /var/www/html
# remove the default page
rm index.html
# unzip the archive, symlink storage and setup permissions
unzip server.zip
php artisan storage:link
chown -R www-data:www-data bootstrap/cache storage .env
chmod -R 755 bootstrap/cache storage
chmod -R 664 .env
# copy the default web host
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/muly.conf
# open it for editing
nano /etc/apache2/sites-available/muly.conf
# open the file for editing
nano /etc/php/7.4/apache2/php.ini
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 100M
upload_max_filesize = 100M
sudo systemctl restart apache2
certbot --apache -d yourapp.com
# enter details and make sure to enable redirection (option 1)
sudo mysql
# run below queries in the mysql prompt
mysql> CREATE DATABASE muly;
mysql> CREATE USER muly@localhost IDENTIFIED WITH mysql_native_password BY '12345678';
mysql> GRANT ALL PRIVILEGES ON muly.* TO muly@localhost;
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
crontab -e -u www-data
# now choose your editor (1 for nano) and add below line at bottom
* * * * * cd /var/www/html && php artisan schedule:run