In this video i show you how to install and deploy Laravel app + Nginx in EC2 instant of AWS.
***Command using in video:
***********install php
sudo apt-get update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php8.2
sudo apt-get install -y php-cli php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-bcmath
**********install composer
curl -sS getcomposer.or... -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
****install nginx
sudo apt update
sudo apt install nginx
**alow nginx
sudo ufw allow 'Nginx HTTP'
***install php fpm
sudo apt install php8.2-fpm
***config nginx
server {
listen 80 default_server;
server_name localhost;
root /home/source;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
index index.html index.php;
client_max_body_size 5M;
location / {
try_files $uri $uri /index.php$is_args$args;
}
location ~ ^/.+\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param REALPATHTEST $realpath_root;
internal;
}
}
***install laravel
composer create-project --prefer-dist laravel/laravel demo
Негізгі бет Deploy and install Laravel + Nginx to AWS step by step
Пікірлер: 16