Install
bash
1sudo apt install nginx -y2sudo apt install software-properties-common -y3sudo add-apt-repository ppa:ondrej/php -y4sudo apt update5sudo apt install php8.0-fpm -y6sudo apt install php8.0-mysql php8.0-curl php8.0-mbstring php8.0-xml php8.0-zip -yConfigure PHP-FPM
php
1cgi.fix_pathinfo=02memory_limit=256M3upload_max_filesize=50M4post_max_size=50Msudo systemctl restart php8.0-fpm
Configure Nginx
bash
1/etc/nginx/sites-available/dev.localbash
1server {2 listen 80;3 server_name dev.local www.dev.local;4
5 root /var/www/dev.local;6 index index.php index.html;7
8 location / {9 try_files $uri $uri/ /index.php?$query_string;10 }11
12 location ~ \.php$ {13 include snippets/fastcgi-php.conf;14 fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;15 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;16 include fastcgi_params;17 }18
19 location ~ /\.ht {20 deny all;21 }22}Enable the site:
bash
1sudo ln -s /etc/nginx/sites-available/dev.local /etc/nginx/sites-enabled/2sudo nginx -t3sudo systemctl reload nginxSet Up the Web Directory
bash
1sudo mkdir -p /var/www/dev.local2sudo chown -R www-data:www-data /var/www/dev.local3sudo chmod -R 755 /var/www/dev.localVerify
php
1<?php2phpinfo();Create MySQL user for db
sql
1CREATE USER 'admin'@'localhost' IDENTIFIED BY 'pass';2GRANT ALL PRIVILEGES ON example_db.* TO 'admin'@'localhost';3FLUSH PRIVILEGES;