bell-ringNginx Server (LEMP)

Linux, Nginx, MySQL, PHP (LEMP stack)

circle-exclamation

Setup Server

1. Login to your server:

Log in to your server using SSH and Terminal. Use the provided credentials based on your server type, like Ubuntu or AWS.

2.Setup NGINX:

Step 1: Installing Nginx

Following that, you can choose to install either NGINX or Apache. However, for the purpose of this demonstration, we'll proceed with NGINX, you can install it using the following command.

sudo apt install nginx

After accepting the procedure, apt will install Nginx and any required dependencies to your server.

Step 2: Adjusting the Firewall

Before testing Nginx, the firewall software needs to be adjusted to allow access to the service. Nginx registers itself as a service with ufw upon installation, making it straightforward to allow Nginx access.

List the application configurations that ufw knows how to work with by typing:

sudo ufw app list

You should get a listing of the application profiles:

As demonstrated by the output, there are three profiles available for Nginx:

Nginx Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)

Nginx HTTP: This profile opens only port 80 (normal, unencrypted web traffic)

Nginx HTTPS: This profile opens only port 443 (TLS/SSL encrypted traffic)

It is recommended that you enable the most restrictive profile that will still allow the traffic you’ve configured. Right now, we will only need to allow traffic on port 80.

You can enable this by typing:

Verify the change by typing:

The output will indicated which HTTP traffic is allowed:

Step 3: Checking your Web Server

At the end of the installation process, Ubuntu 20.04 starts Nginx. The web server should already be up and running.

The systemd init system to make sure the service is running by typing:

As confirmed by this out, the service has started successfully. However, the best way to test this is to actually request a page from Nginx.

3. Installing PHP

To install php package, run the following command:

Once the installation is finished, you can run the following command to confirm your PHP version:

4. Installing Composer

Update the local repository lists by entering the following in a command line.

The following curl command to have the latest Composer version.

To test composer installation, run:

5. Install MySQL Database & User

Now that you have a web server up and running, you need to install the database system to be able to store and manage data for your site. MySQL is a popular database management system used within PHP environments.

When prompted, confirm installation by typing Y, and then ENTER.

Start the interactive script by running:

When you’re finished, test whether you’re able to log in to the MySQL console by typing:

This will connect to the MySQL server as the administrative database user root, which is inferred by the use of sudo when running this command. Below is an example output:

Create MySQL database and assign all privileges by using following commands:

7. Change permission for the www folder

8. Upload Gocab Laravel to Server

To make a new directory on your website, just type this command:

  1. Download the Gocab-laravel-react_native-package zip file from CodeCanyon and unzip it on your computer.

  2. Inside the unzipped folder, find Gocab_laravel folder

  3. Upload the Gocab_laravel folder to the server at the path /var/www/Gocab/.

9. Enable multiple sites on nginx

To begin, configure server and establish a Reverse Proxy to host multiple sites on the same server. Start by disabling the default settings.

10. Create Nginx domain

Include the following Nginx configuration in your edited file:

circle-info

Ensure to replace "your-domain.com" with the actual domain name you are using.

After making your changes, press CTRL and X, then confirm by pressing Y and ENTER to save and close the file.

To enable the configuration, enable it with an easy command.

Please make sure there are no mistakes in the configuration by typing:

Then restart Nginx server.

11. Secure Nginx Server

You need to modify its settings to permit HTTPS traffic. Fortunately, Nginx creates specific profiles in ufw during installation.

Installing GoCab Laravel

1. Initially, navigate to the Gocab_laravel directory, and change the file named .env.example as .env.

If you're running your Laravel project on your own computer (localhost), make sure to use localhost with current running port and put in APP_URL. as a given example below

If you want to install on live server, you need to add your live server Gocab_laravel url like a APP_URL=http://your-domain.com.

circle-exclamation

2. Install Required Dependencies:

In the Gocab_laravel folder, run following command in the terminal to install the required dependencies.

3. Generate Laravel APP KEY:

Once the necessary dependencies are successfully installed, run following command to generate laravel app key.

4. Installation of GoCab:

circle-info

Note: If you've previously run following command or migrated tables, be aware of the fact that it will erase all of your data.

Then, run following command to install GoCab database table.

During the installation, you'll be asked two questions:

1. Do you want to continue with the installation? If you say yes, GoCab will continue to install.

2. Do you want to import in sample data? If you say yes, the sample data will be imported. If you say no, the installation will go ahead without adding any sample data.

5. Link Storage folder to Public folder:

Then, run following command to store and display images correctly.

6. Run GoCab Laravel:

Once you've finished all the previous steps, you can run the Gocab_laravel by adding following command.

When you start your Gocab Laravel project, it typically runs on the default port, you can access it by opening 127.0.0.1:8000 arrow-up-rightin your web browser.

7. Verify GoCab Purchase Code:

Before using the GoCab Laravel, it's important to verify your Envato purchase code.

Enter in your Envato username and the GoCab purchase code and click next button.

If you don't know where to find your purchase code, click here: Where Is My Purchase Code?arrow-up-right

circle-exclamation

Congratulations, GoCab has been successfully installed and configured in your system!🎉

Default Credentials

Admin Credential:

Url: https://your-domain.com/admin/loginarrow-up-right

Email: admin@example.com

Password: 123456789

Driver Credential:

Url: https://your-domain.com/admin/loginarrow-up-right

Email: driver@example.com

Password: driver@123

User Landing Page: https://your-domain.comarrow-up-right

Last updated