Regarding Nginx, upgrading is fairly easy and usually doesn’t break anything. You need to add a new repo, then Nginx can be upgraded every time you run your
sudo apt upgrade command.
The first steps you’ll want to do is backing up your current NGINX configs. You can run these two commands to create a backup directory and copy your config files over to it:
sudo mkdir /etc/nginx-backup/
sudo cp -r /etc/nginx/* /etc/nginx-backup/
Next we need to add the repository. For this, you’ll need to install software-properties-common if it’s not already installed. Run this command to make sure it is installed:
sudo apt-get install software-properties-common
Now we’ll add the NGINX repo by running these commands:
sudo add-apt-repository ppa:nginx/$nginx
Once done, you’ll need to update your system like so
sudo apt-get update
sudo apt-get full-upgrade
You’ll be prompted to use a new config files twice, you’ll want to answer N to those for now to keep your current version.
Now when you run
sudo nginx -v you should see a new version.
Finally, you’ll want to edit your
/etc/nginx/nginx.conf file and add this line just below the pid line near the top:
sudo nginx -t to test the new config and make any changes you need in order for it to pass the test.
Then restart your nginx service and you are good to go.
In this case rather than updating, you’ll just install a higher PHP version on your droplet.
Here are the steps, if you are on an Ubuntu.
Make sure your Ubuntu server is having the latest packages by running the following command.
sudo apt update
sudo apt upgrade
Add a repository for PHP 7.3
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.3-fpm
PHP with it’s extensions is useless so you’ll need to install them regardless which Web Service you are using. The next command will include the most common extensions
sudo apt install php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip php7.3-intl -y
If you need to add another one, just type in
sudo apt install php7.3-nameofextension
And you are ready, you now have the latest PHP version on your droplet.