Setting Up Nginx with MariaDB and PHP/PHP-FPM on Fedora 24 Server and Workstation


Hosting websites and online applications requires setting up a web server infrastructure. In this article, we'll try to understand the setting up of Nginx on Fedora 24 Server and Workstation using MariaDB and PHP/PHP-FPM. This combination creates a strong stack for managing databases and presenting dynamic content. The main concepts covered here can be applied to subsequent versions of Fedora or other Linux distributions, even if Fedora 24 is an older edition.

Main Characteristics of Fedora 24 Server

Fedora 24 Server was created using the Linux kernel, which serves as the foundation of the operating system. The Linux kernel offers crucial features such as device drivers, memory management, process management, and hardware support.

  • Server-focused Packages − Fedora 24 Server edition came with a number of server-focused packages that let users configure and control a range of server services and applications. These bundles included email servers, web servers, database servers, and more.

  • DNF Package Manager  DNF (Dandified Yum) served as Fedora 24 Server's default package manager. It offered a command-line interface for installing, removing, and updating systems. Compared to Yum, DNF offers better speed and dependency resolution.

  • Server Roles  With the introduction of server roles in Fedora 24 Server, users were now able to choose certain server configurations at installation time. Various server kinds, including file servers, database servers, domain controllers, and web servers, were catered for by these roles, which also supplied pre-defined software packages and settings.

  • Fedora 24 Server introduces the web-based management interface Cockpit, which was created to make server administration jobs easier. With Cockpit, users could use a web browser to manage system services, keep track of system performance, set up networking, and carry out simple administrative duties.

  • Security and Community-driven Development  By including the most recent security patches and upgrades, Fedora 24 Server gave stability and security first priority. The distribution benefited from a thriving and active community that participated in its development, testing, and enhancement as a member of the Fedora Project.

  • Fedora Ecosystem  Fedora 24 Server was one of several versions that made up the wider Fedora ecosystem, along with Fedora Workstation and Fedora Atomic. From desktop computing to cloud and server installations, the ecosystem intended to offer a variety of solutions for various use cases.

Fedora 24 also makes the use of Nginx web server easier because of its inclusion as a package in its official repository. Nginx is also widely accepted because of its high-performance, lightweight, and efficient architecture. The convergence of both of these platforms is talked about in this article.

It's crucial to remember that Fedora versions only normally receive support for a period of 13 months. As a result, updates and security fixes are no longer officially provided for Fedora 24 Server. For server installations, it is advised to utilize a more recent version of Fedora or look into other Linux distributions that provide long-term maintenance.

Methods Used

  • Using the LEMP stack installer script

  • Manual installation

Using the LEMP Stack Installer Script

The installation and configuration of the LEMP stack (Linux, Nginx, MySQL/MariaDB, PHP/PHP-FPM) on a Linux server is automated using the LEMP stack installer script. By taking care of the necessary software component installation and configuration automatically, this script makes it easier to deploy the LEMP stack.

A third-party company or an open-source community normally creates and maintains the LEMP stack installation script. It seeks to speed up the installation procedure and provide uniform configuration across various platforms. The script often comes with preset configurations and best practice-based optimizations.

Algorithm

  • Initiate by installing nginx on Fedora 24 and proceed with the nginx service

sudo dnf install nginx
sudo systemctl start nginx
  • Install MariaDB and start the service.

sudo dnf install mariadb-server
sudo systemctl start mariadb
  • Install PHP an dPHP-FPM on Fedora 24 using the command and start its service as well.

sudo dnf install php php-fpm
sudo systemctl start php-fpm
  • Download the LEMP Stack Installer script with the help of the given code. Make the Script executable and then run the script.

wget https://raw.githubusercontent.com/rtCamp/easyengine/master/services/nginx/install.sh

sudo chmod +x install.sh

sudo bash install.sh
  • Test the full setup, if it's working correctly.

Manual Installation

In order to manually install Nginx with MariaDB and PHP/PHP-FPM on Fedora 24 Server and Workstation, each component must first be installed and then configured to function together.

Algorithm

  • Install the pre- requisites, like we did in the previous method:(Install nginx, MariaDB, PHP and PHP-FPM.

  • Configure nginx to work with PHP-FPM using the given series of code

sudo nano /etc/nginx/nginx.conf

server {
   location ~ \.php$ {
      fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
   }
}
  • Save the file and test the configuration of nginx.

  • Check the PHP information page to see the PHP installation details.

  • You can also perform additional configurations, this is optional but will make it work to your specific requirement.

Conclusion

In conclusion, setting up Nginx, MariaDB, and PHP/PHP-FPM on Fedora 24 Server and Workstation produces a dynamic web server environment that can handle databases.

Following the manual installation process outlined in this article will enable you to appropriately configure each component and build a dependable infrastructure for hosting websites and online applications.

The manual installation technique entails installing and configuring each component one at a time in order to guarantee proper compatibility. The web server is set up using Nginx and ready to receive incoming requests. A security configuration has been made for the database management system MariaDB. Nginx can run PHP scripts since PHP/PHP-FPM is installed and integrated.

While working with Fedora 24, it should be kept in mind that it is an outdated version, which no longer is updated or fixed. It is strongly advised to use recent versions which receive security fixes or other Linux distributions for the better security of your data and compatibility of the device.

In conclusion, Fedora 24 may be set up manually or using the installer script to provide a reliable web server environment that can be used to host dynamic websites, develop online applications, and effectively manage databases.

Updated on: 03-Aug-2023

289 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements