Muly
Search…
Installation - Server
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

  1. 1.
    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).
  2. 2.
    You web server runs under www-data user (LAMP/LEMP only, not applicable to cPanel install).
  3. 3.
    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.

cPanel

To install the script on cPanel, we have made an easy to follow video available in our YouTube channel on https://bit.ly/muly-cpanel-install-2 link.

LAMP or LEMP

Below instructions assume that you are familiar with command line and cloud deployments. The steps are inclined towards standard LAMP distribution offered by DigitalOcean here. 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:
1
scp server.zip [email protected]:/var/www/html/server.zip
Copied!
Then SSH into the server and proceed with installing dependencies.
Copied!
1
# update index with latest packages
2
sudo apt update
3
4
# required to extract the uploaded archive
5
sudo apt install unzip
6
7
# the extensions that do not come by default
8
sudo apt install php-bcmath php-curl php-mbstring php-redis php-xml
9
10
# needed for sending forgot password emails (optional)
11
sudo apt install sendmail
12
13
# needed for background job processing (optional)
14
sudo apt install redis-server supervisor
15
16
# needed for uploading clips from admin panel (optional)
17
sudo apt install ffmpeg
Copied!
Now you can extract the uploaded ZIP archive and setup file/folder permissions.
1
# change to server's document root
2
cd /var/www/html
3
4
# remove the default page
5
rm index.html
6
7
# unzip the archive, symlink storage and setup permissions
8
unzip server.zip
9
php artisan storage:link
10
chown -R www-data:www-data bootstrap/cache storage .env
11
chmod -R 755 bootstrap/cache storage
12
chmod -R 664 .env
Copied!
Now create a copy of apache's default vhost for our app.
1
# copy the default web host
2
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/muly.conf
3
4
# open it for editing
5
nano /etc/apache2/sites-available/muly.conf
Copied!
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.
muly.conf
1
<VirtualHost *:80>
2
ServerName yourapp.com
3
ServerAdmin [email protected]
4
DocumentRoot /var/www/html/public_html
5
6
<Directory /var/www/html/public_html/>
7
Options Indexes FollowSymLinks
8
AllowOverride All
9
Require all granted
10
</Directory>
11
12
ErrorLog ${APACHE_LOG_DIR}/error.log
13
CustomLog ${APACHE_LOG_DIR}/access.log combined
14
15
<IfModule mod_dir.c>
16
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
17
</IfModule>
18
</VirtualHost>
Copied!
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.
1
sudo a2dissite 000-default
2
sudo a2ensite muly
3
sudo a2enmod rewrite
4
sudo systemctl restart apache2
Copied!
Some PHP (assuming version 7.4, replace with yours) settings must also be tweaked to allow bigger uploads (and mostly on slower connections).
1
# open the file for editing
2
nano /etc/php/7.4/apache2/php.ini
Copied!
Then find and update below options as shown. You can use Ctrl+W to quickly locate them.
php.ini
1
max_execution_time = 300
2
max_input_time = 300
3
memory_limit = 128M
4
post_max_size = 100M
5
upload_max_filesize = 100M
Copied!
Then restart the apache server as below:
1
sudo systemctl restart apache2
Copied!
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:
1
certbot --apache -d yourapp.com
2
3
# enter details and make sure to enable redirection (option 1)
Copied!
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.
1
sudo mysql
2
3
# run below queries in the mysql prompt
4
mysql> CREATE DATABASE muly;
5
mysql> CREATE USER muly@localhost IDENTIFIED WITH mysql_native_password BY '12345678';
6
mysql> GRANT ALL PRIVILEGES ON muly.* TO muly@localhost;
7
mysql> FLUSH PRIVILEGES;
8
mysql> EXIT;
Copied!
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:
1
crontab -e -u www-data
2
3
# now choose your editor (1 for nano) and add below line at bottom
4
* * * * * cd /var/www/html && php artisan schedule:run
Copied!
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:
1
nano /etc/supervisor/conf.d/muly.conf
Copied!
Put below contents in the file and save.
muly.conf
1
[program:muly]
2
process_name=%(program_name)s_%(process_num)02d
3
command=php /var/www/html/artisan queue:work --sleep=3 --tries=1 --timeout=300
4
autostart=true
5
autorestart=true
6
user=www-data
7
numprocs=2
8
redirect_stderr=true
9
stdout_logfile=/var/www/worker.log
10
stopwaitsecs=3600
Copied!
Then restart the Supervisor as follows:
1
sudo supervisorctl reread
2
sudo supervisorctl update
3
sudo supervisorctl start muly:*
Copied!
The server has now been setup and you can proceed to building the Android app.