Here is a step-by-step guide to install Laravel with a LEMP stack on Ubuntu 22.04:
Update your Ubuntu system

Install Nginx

- Check the status of Nginx

- Start the Nginx service:

- Enable the Nginx service to start automatically on boot:

Install MariaDB

Secure MariaDB installation

Log in to the MariaDB console

Create a database for Laravel:

Create a database user and grant privileges:

Exit the MariaDB console:

Install PHP and required extensions
Add the Ondrej sury PPA repository:

Install PHP and required extensions

Install composer
Download the Composer installer:

Run the installer:

Remove the installer:

Verify the Composer installation:

Create Laravel project

Set proper permissions for the Laravel project:

Configure Nginx for Laravel
Create a new Nginx server block configuration file for the Laravel project
Add the following content to the file:

Save and close the file.
Create a symbolic link from the new server block configuration file to the sites-enabled directory:

Test the Nginx configuration:
If the test is successful, restart the Nginx service:

Update the Laravel .env file to use a MySQL database
Open the Laravel .env file and Update the database connection information:

Migrate the database tables:

Test your Laravel installation in a web browser
