sudo systemctl stop apache2.service
sudo apt remove apache2
sudo apt remove "libapache2-mod-php*"sudo apt update
sudo apt install nginx -y
sudo systemctl enable nginxHope you have already installed the php-cli, lets install the glue now
sudo apt install php8.2-fpm
sudo systemctl start php8.2-fpm- Check for syntax errors
sudo nginx -t- Reload after updating the configurations
sudo systemctl reload nginxYou can tweak php.ini at this location
/etc/php/8.2/fpm/php.ini