Install Laravel 5.8 Nginx Php7.3


Install Laravel 5.8 Nginx Php7.3

Overview

Installing Laravel 5.8 on a Nginx server running PHP 7.3 can be a tricky task. This tutorial explains how to install the popular open source web framework on Nginx and PHP 7.3. Specifically, we will be discussing how to install and configure the Laravel 5.8 software stack on Ubuntu Linux. We will be using Nginx as the web server, PHP 7.3 as the programming language and phpMyAdmin as the database backend.

Laravel is an open source, MVC (model-view-controller) PHP framework. It is widely used for building customized web applications with incredible scalability and security. It is designed to make development easier and faster. With Laravel, application development is made easier by providing simple, expressive syntax for the most common tasks.

Nginx is a popular open-source web server. It is used by many high traffic websites and can handle static and dynamic content with ease. It is also used for load balancing and is an ideal choice for deploying web applications and services.

PHP 7.3 is the latest version of the popular scripting language. It is fast, secure, and lightweight. It offers various new features and improved performance compared to previous versions. It is an ideal choice for building powerful and secure web applications.

Requirements

To install Laravel 5.8 on an Nginx server running PHP 7.3, you will need the following:

  • Nginx web server
  • PHP 7.3
  • MySQL or MariaDB database server
  • Composer, the PHP dependency manager

To install Laravel 5.8 on an Nginx server running PHP 7.3, the following steps need to be followed:

Step 1: Install Nginx

Nginx can be installed using the Ubuntu repositories. To install Nginx on Ubuntu, use the following commands:

sudo apt update
sudo apt install nginx

Once the installation is complete, the Nginx service can be started and enabled to start on boot using the following commands:

sudo systemctl start nginx
sudo systemctl enable nginx

To check that Nginx is running correctly, visit http://localhost on a web browser. You should see the default Nginx welcome page.

Step 2: Install PHP 7.3

PHP 7.3 can be installed using the Ubuntu repositories. To install PHP 7.3 on Ubuntu, use the following commands:

sudo apt install php7.3-fpm php7.3-mysql php7.3-common php7.3-mbstring php7.3-xml php7.3-gd php7.3-cli php7.3-zip

Once the installation is complete, the PHP 7.3 FPM service can be started and enabled to start on boot using the following commands:

sudo systemctl start php7.3-fpm
sudo systemctl enable php7.3-fpm

To check that PHP 7.3 is running correctly, use the following command:

php -v

You should see the output of the command as follows:

PHP 7.3.xx (cli) (built: xx xx xx xx)
Copyright (c) 1997-2018 The PHP Group

Step 3: Install MySQL or MariaDB

MySQL or MariaDB can be installed using the Ubuntu repositories. To install MySQL or MariaDB on Ubuntu, use the following commands:

sudo apt-get update
sudo apt-get install mysql-server

Once the installation is complete, the MySQL service can be started and enabled to start on boot using the following commands:

sudo systemctl start mysql
sudo systemctl enable mysql

You can also use the MySQL command line client to check that MySQL is running correctly:

sudo mysql -u root -p

You should see the MySQL shell prompt when the command is executed successfully.

Step 4: Install Composer

Composer is a popular dependency manager for PHP. It can be used to install and manage packages written in PHP. To install Composer on Ubuntu, use the following commands:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Once the installation is complete, check that Composer is running correctly using the following command:

composer --version

You should see the version of Composer installed.

Step 5: Install Laravel 5.8

Laravel can be installed using Composer. To install Laravel 5.8, use the following command:

composer create-project --prefer-dist laravel/laravel 5.8

This will create a new Laravel 5.8 project in the current directory. To test that Laravel is installed correctly, use the following command:

php artisan --version

You should see the version of Laravel installed.

Step 6: Configure Nginx

Nginx needs to be configured to serve the Laravel application. To do this, edit the default server block in the file `/etc/nginx/sites-enabled/default`, and add the following changes:

server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/laravel/public;
index index.php index.html index.htm index.nginx-debian.html;

server_name _;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}

}

Save the file and exit. Then, restart the Nginx web server using the following command:

sudo systemctl restart nginx

Conclusion

In this tutorial, we have seen how to install the Laravel 5.8 web framework on an Nginx server running PHP 7.3. We discussed the steps in detail and explained how to configure Nginx to serve our Laravel application. Learning how to install and configure the Laravel framework can help you get started with developing web applications faster. Thanks for reading this article.

FAQs

Q: What is Laravel?

A: Laravel is a popular open source, MVC (model-view-controller) PHP framework. It is designed to make development easier and faster with its simple, expressive syntax for the most common tasks.

Q: What is PHP 7.3?

A: PHP 7.3 is the latest version of the popular scripting language. It is fast, secure, and lightweight. It offers various new features and improved performance compared to previous versions.

Q: What is Composer?

A:

Leave a Reply

Your email address will not be published. Required fields are marked *