
Update apt-get
apt-get update -y && apt-get upgrade -y
Install php-fpm
add-apt-repository ppa:ondrej/nginx-mainline apt install -y software-properties-common apt -y update apt install -y php7.4 php7.4-fpm php7.4-cgi php7.4-mysql php7.4-common php7.4-mbstring php7.4-xml php7.4-curl
Setup Nginx
vi /etc/nginx/sites-available/example.com
server {
listen 80;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
remove the default configuration
unlink /etc/nginx/sites-enabled/default
Setup folder permission
cd /var/www chown -R www-data. *



