Best laravel framework open-source packages.

Fashion shop laravel

Website Fashion Shop built using Laravel, Mysql
Updated 1 year ago

Link demo: Fashion Shop

How to Deploy Laravel Application on AWS EC2?

  1. Create EC2 Instance
    https://www.howtoforge.com/how-to-create-an-ec2-instance-on-aws/

  2. To host our Laravel app on Amazon EC2 we will be using the following technical stack:

  • PHP 8.0
  • Composer
  • Mysql
  • Nginx

--------------------------------------------------Setup project--------------------------------------------------

  1. Permission Folder:
sudo chown -R www-data:www-data /var/www
  1. Clone project:
cd /var/www
git clone https://github.com/Vo-Huy-Khoa/fashion-shop-laravel.git

--------------------------------------------------Install PHP--------------------------------------------------

  1. updating your package list by running the following command:
sudo apt-get update
  1. Add the ondrej/php PPA using the following commands:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
  1. Once the PPA is added and your package list is updated, try installing the packages again:
sudo apt-get install php8.0-common php8.0-mysql php8.0-cgi php8.0-mbstring php8.0-curl php8.0-gd php8.0-xml php8.0-xmlrpc php-pear php8.0-fpm

--------------------------------------------------Install Composer---------------------------------------------

  1. Download the installer:
curl -sS https://getcomposer.org/installer -o composer-setup.php
  1. Verify the installer:
HASH="$(curl -sS https://composer.github.io/installer.sig)"
echo "$HASH composer-setup.php" | sha384sum -c -
  1. Install Composer:
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
  1. Verify the installation:
composer --version

--------------------------------------------------Install Mysql------------------------------------------------

  1. Install MySql
sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql.service
  1. Set Password For Root
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
exit
  1. Create Database
sudo mysql -u root -p
CREATE DATABASE fashion;
exit
  1. Import File Sql To Database
mysql -u root -p fashion < shopfashion.sql
  1. When error password root:
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mật_khẩu_mới';

--------------------------------------------------Install Nginx------------------------------------------------

  1. Install Nginx
sudo apt install nginx
  1. Start Nginx
sudo systemctl start nginx
  1. Enable Nginx
sudo systemctl enable nginx
  1. Check status Nginx
sudo systemctl status nginx
  1. Check File Config Nginx
sudo nginx -t
  1. Restart Nginx
sudo systemctl restart nginx

--------------------------------------------------Config Nginx-------------------------------------------------

  1. To The File Config Nginx:
cd /etc/nginx/sites-available/
  1. To the file default:
sudo vim default
  1. Create Value In File Default:
server {
  listen 80;
  listen [::]:80;
  root /var/www/fashion-shop-laravel/public;
  add_header X-Frame-Options "SAMEORIGIN";
  add_header X-Content-Type-Options "nosniff";
  index index.php;
  charset utf-8;
  
  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }
  
  location = /favicon.ico { 
    access_log off; 
    log_not_found off; 
  }
  
  location = /robots.txt  { 
    access_log off; 
    log_not_found off; 
  }
  
  error_page 404 /index.php;
  
  location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
  }
  
  location ~ /\.(?!well-known).* {
    deny all;
  }
}
  1. Check File Config Nginx
sudo nginx -t

--------------------------------------------------Config Laravel--------------------------------------------------

  1. Update Composer
composer update
  1. Generate Key
php artisan key:generate
Tags mysql nginx