What is Nginx?
Before we get into installation of Nginx on Linux Mint 20, we need to first understand what Nginx is and where it is used.
So what exactly in Nginx and where can I use it?. Nginx is an open-source software that servers quite a number of purposes which include being a web server, cache, proxy and reverse proxy, load balancer and used in media streaming. The goal behind the development of nginx was to produce a high speed web server which has now facilitated the creation of highly scalable websites. Being a fast webserver nginx became suitable for situations that called for many and fast connections such as reverse proxying and load balancing since it can handle large volumes of simultaneous connections. Nginx also acts as an SSL/TLS terminator between a client and a web server, handling tasks such as SSL negotiation that might sometimes slows the web server.
What is PHP-FPM?
Having looked at what Nginx is, the next question we should be asking ourselves is ‘what is PHP-FPM?”. PHP-FPM (PHP FastCGI process manager) serves requests between PHP and the web server just like mod_php module when using Apache web server. PHP-FPM is highly enhanced in speed. In this guide we are going to look at how to install Nginx with PHP-FPM in Linux mint 20 and how to use them with wordpress.
Install Nginx & PHP-FPM on Linux Mint 20
Before any installation, ensure that your system is running the latest version and that your packages are up to date.
sudo apt-get update sudo apt-get upgrade -y
After the updates, it is highly recommended to reboot your machine to ensure that the new changes take effect.
Install Nginx on Linux Mint 20
Having update your packages, it is time to install Nginx in your Linux Mint 20. Run the command as shown to install Nginx.
sudo apt-get install nginx -y
To verify installation, check whether Nginx is running by using the command below
sudo systemctl status nginx
If running the output should be as shown.
Now if you are running a firewall you need to allow Nginx ports through the firewall
sudo ufw allow proto tcp from any to ant port, 80, 443
Install PHP-FPM on Linux Mint 20
Follow the steps below to install PHP-FPM on Linux Mint 20 to work with Nginx
First run system updates, add ondrej/php repository and ensure to update the repository.
sudo apt-get update sudo add-apt-repository ondrej/php sudo apt update
After updating your repository, you can go ahead to install php-fpm on your Linux Mint 20
sudo apt install -y php7.4 php7.4-cli php7.4-fpm php7.4-json php7.4-pdo php7.4-mysql php7.4-zip php7.4-opcache php7.4-gd php7.4-curl php7.4-mysql
After installation completes, check php version with the below command
$ php -v
This has been a guide on how to install Nginx with PHP-FPM on Linux Mint 20 and to use with a WordPress site. Enjoy you development!.
Click links below for more interesting guides: