If Upgrading, start from here:

sudo apt-get purge php7.* -y
sudo apt-get autoclean
sudo apt-get autoremove -y

If Installing directly to PHP8.0, start from here:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

sudo apt install php8.0-common php8.0-mysql php8.0-xml php8.0-curl php8.0-gd php8.0-imagick php8.0-cli php8.0-dev php8.0-imap php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip php8.0-fpm php8.0-snmp php-memcached -y

sudo php-fpm8.0 -t 
sudo service php8.0-fpm restart
sudo service nginx restart


php -v

Edit FPM Servers

sudo nano /etc/php/8.0/fpm/pool.d/www.conf

https://josuamarcelc.medium.com/try-to-optimizing-php-fpm7-3-configuration-with-nginx-78268eb90261

Edit FPM Pools at

sudo nano /etc/php/8.0/fpm/php.ini
upload_max_filesize = 32M 
post_max_size = 48M 
memory_limit = -1 
max_execution_time = 600 
max_input_vars = 3000 
max_input_time = 1000

Edit your configuration.

sudo nano /etc/nginx/sites-available/your.conf

The line you need to modify will look like this.

fastcgi_pass unix:/run/php/php7.4-fpm.sock; 

You need to replace the old PHP version with the new version.

fastcgi_pass unix:/run/php/php8.0-fpm.sock; 

Check PHP version.

php -v