Setting up the server for Food Delivery Script?

Learn to set up the Food Delivery script easily with the help of our Step by Step Installation guide.
Post Reply
fooddelivery
Site Admin
Posts: 9
Joined: Mon May 20, 2019 5:28 pm

Setting up the server for Food Delivery Script?

Post by fooddelivery » Thu Jun 06, 2019 7:53 pm

Setting up Your Server

Our recommended server configuration is
Ubuntu 16.04 with MySQL 5.5 and Laravel 5.4 (with composer and other dependencies)

Let’s do this. Fire up your SSH client and connect it to the server using the credentials provided.

Setting up Apache on Ubuntu 16.04

Apache is available within Ubuntu's default software repositories, so we will install it using conventional package management tools.

We will begin by updating the local package index to reflect the latest upstream changes. Afterwards, we can install the apache2 package:

Code: Select all

sudo apt-get update
sudo apt-get install apache2
After confirming the installation, apt-get will install Apache and all required dependencies.

Installing Curl

To install Curl enter the below command

Code: Select all

$ sudo apt-get install curl
When you have your server's IP address or domain, enter it into your browser's address bar:

Code: Select all

http://Your-ip-or-domain-name
You will see the default Apache page this shows that Apache is successfully installed.
small_apache_default.png
small_apache_default.png (557.83 KiB) Viewed 12907 times
Installing MySQL

Now that we have our web server up and running, it is time to install MySQL. MySQL is a database management system. Basically, it will organize and provide access to databases where our site can store information.

Again, we can use apt to acquire and install our software. This time, we'll also install some other "helper" packages that will assist us in getting our components to communicate with each other:

Code: Select all

$ sudo apt-get install mysql-server
Again, you will be shown a list of the packages that will be installed, along with the amount of disk space they'll take up.

Enter Y to continue. During the installation, your server will ask you to select and confirm a password for the MySQL "root" user.

This is an administrative account in MySQL that has increased privileges. Think of it as being similar to the root account for the server itself (the one you are configuring now is a MySQL-specific account, however).

Make sure this is a strong, unique password, and do not leave it blank. When the installation is complete, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system a little bit.

Start the interactive script by running:

Code: Select all

$mysql_secure_installation
You will be asked to enter the password you set for the MySQL root account. Next, you will be asked if you want to configure the VALIDATE PASSWORD PLUGIN.

Answer Y for yes, or anything else to continue without enabling.

You'll be asked to select a level of password validation. Keep in mind that if you enter 2, for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words.

If you are happy with your current password, enter n for "no" at the prompt:
For rest of the questions press Y and hit Enter

Installing PHP

To install PHP and it’s dependencies that connect to MYSQL, etc, we run the following command

Code: Select all

$ sudo apt-get install php7.0 libapache2-mod-php php-mcrypt php-mysql
The PHP should run without running into any hiccups.

To do this, type this command to open the dir.conf file in a text editor with root privileges:

Code: Select all

$sudo nano /etc/apache2/mods-enabled/dir.conf
'

It will look like this:

/etc/apache2/mods-enabled/dir.conf >>

Code: Select all

<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
Now, specify ‘index.php’ right after DirectoryIndex, as shown below

Code: Select all

<IfModule mod_dir.c>
DirectoryIndex index.php index.cgi index.pl index.html index.xhtml index.htm
</IfModule>
When you are finished, save and close the file by pressing Ctrl-X. You'll have to confirm the save by typing Y and then hit Enter to confirm the file save location.

After this, we need to restart the Apache web server in order for our changes to be recognized. You can do this by typing this:

Code: Select all

$ sudo systemctl restart apache2 
Now let’s install other dependencies by enter the following command.

Code: Select all

$sudo apt-get install php-cli php-cgi php-common php-gd php-gmp
Once the dependencies are installed. Let’s check if the correct configurations are working.

In order to test that our system is configured properly for PHP, we can create a very basic PHP script.
We will call this script info.php. In order for Apache to find the file and serve it correctly, it must be saved to a very specific directory, which is called the "web root".
In Ubuntu 16.04, this directory is located at /var/www/html/. We can create the file at that location by typing:

Code: Select all

$sudo nano /var/www/html/info.php
This will open a blank file. We want to put the following text, which is valid PHP code, inside the file:

Code: Select all

<?php
phpinfo();
?>
small_php_info.png
small_php_info.png (283.24 KiB) Viewed 12907 times
Once you have successfully checked, the installation, you should remove this file.

Installing Laravel Composer

The food delivery script requires the Laravel framework to run. To install the laravel & composer make sure you have PHP 7.0 installed.

On the SSH terminal, type the following command:

Code: Select all

$sudo apt-get install php7.0-mbstring php7.0-xml composer unzip
One final step, we would need to install the composer, update it and restart the apache server.

Code: Select all

$ composer install
$ composer update
$ sudo systemctl restart apache2
Great, you have now configured the server environment.

Next, we would be uploading the script through FTP and then unzipping it before configuring it.

Post Reply