Configuring Nginx, MariaDB and PHP/PHP-FPM on Fedora 24 servers and workstations

WBOY
Release: 2023-09-07 13:34:01
forward
884 people have browsed it

配置Nginx、MariaDB和PHP/PHP-FPM在Fedora 24服务器和工作站上

Hosting websites and online applications requires setting up a web server infrastructure. In this article, we will try to understand setting up Nginx on Fedora 24 servers and workstations using MariaDB and PHP/PHP-FPM. This combination creates a powerful stack for managing databases and rendering dynamic content. The main concepts presented here can be applied to subsequent versions of Fedora or other Linux distributions, even if Fedora 24 is an older version.

Main Features of Fedora 24 Server

Fedora 24 Server is created using the Linux kernel, which is the foundation of the operating system. The Linux kernel provides important functions such as device drivers, memory management, process management, and hardware support.

  • Server-centric packages - Fedora 24 Server edition comes with a number of server-centric packages that allow users to configure and control a range of server services and applications. These bundles include email servers, web servers, database servers, and more.

  • DNF Package Manager DNF (Dandified Yum) acts as the default package manager for Fedora 24 Server. It provides a command line interface for installing, removing, and updating systems. DNF provides better speed and dependency resolution compared to Yum.

  • Server Roles With the introduction of server roles in Fedora 24 Server, users can now select certain server configurations during installation. These roles address the needs of a variety of server types, including file servers, database servers, domain controllers, and web servers, and also provide predefined packages and settings.

  • Fedora 24 Server introduces Cockpit, a web-based management interface created to make server management easier. With Cockpit, users can use a web browser to manage system services, track system performance, set up networks, and perform simple administrative duties.

  • Security and Community-Driven Development Fedora 24 Server puts stability and security first by including the latest security patches and upgrades. The distribution benefits from a thriving and active community that participates in its development, testing, and enhancements as members of the Fedora Project.

  • Fedora Ecosystem Fedora 24 Server is one of several versions that make up the broader Fedora ecosystem, along with Fedora Workstation and Fedora Atomic. From desktop computing to cloud and server installations, the ecosystem is designed to provide a variety of solutions for various use cases.

Fedora 24 also makes using the Nginx web server easier as it is included as a package in its official repository. Nginx is also widely accepted for its high performance, lightweight, and efficient architecture. This article discusses the convergence of these two platforms.

It's important to remember that Fedora releases are typically only supported for 13 months. Therefore, updates and security fixes are no longer officially provided for Fedora 24 Server. For server installations, it is recommended to use a newer version of Fedora or look into other Linux distributions that offer long-term maintenance.

usage instructions

  • Using the LEMP stack installer script

  • Manual installation

Using the LEMP Stack installer script

Automatically install and configure LEMP stacks (Linux, Nginx, MySQL/MariaDB, PHP/PHP-FPM) on Linux servers using the LEMP stack installer script. This script makes deploying a LEMP stack easier by automating the necessary software component installation and configuration.

Third-party companies or open source communities often create and maintain LEMP stack installation scripts. It is designed to speed up the installation process and provide unified configuration across different platforms. The script usually comes with preset configurations and optimizations based on best practices.

algorithm

  • First install nginx on Fedora 24 and continue to use nginx service

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

sudo dnf install mariadb-server
sudo systemctl start mariadb
Copy after login
  • 使用命令在 Fedora 24 上安装 PHP 和 dPHP-FPM 并启动其服务。

sudo dnf install php php-fpm
sudo systemctl start php-fpm
Copy after login
  • 借助给定代码下载 LEMP Stack 安装程序脚本。使脚本可执行,然后运行脚本。

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

sudo chmod +x install.sh

sudo bash install.sh
Copy after login
  • 测试完整设置是否正常工作。

手动安装

为了在 Fedora 24 服务器和工作站上手动安装带有 MariaDB 和 PHP/PHP-FPM 的 Nginx,必须首先安装每个组件,然后配置为一起运行。

算法

  • 安装先决条件,就像我们在之前的方法中所做的那样:(安装 nginx、MariaDB、PHP 和 PHP-FPM。

  • 使用给定的一系列代码将 nginx 配置为与 PHP-FPM 配合使用

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;
   }
}
Copy after login
  • 保存文件并测试nginx的配置。

  • 检查 PHP 信息页面以查看 PHP 安装详细信息。

  • 您还可以执行其他配置,这是可选的,但可以使其满足您的特定要求。

结论

总之,在 Fedora 24 服务器和工作站上设置 Nginx、MariaDB 和 PHP/PHP-FPM 会产生一个可以处理数据库的动态 Web 服务器环境。

遵循本文中概述的手动安装过程将使您能够正确配置每个组件并构建用于托管网站和在线应用程序的可靠基础架构。

手动安装技术需要一次安装和配置每个组件,以保证适当的兼容性。 Web 服务器使用 Nginx 设置并准备好接收传入请求。已对数据库管理系统MariaDB进行了安全配置。由于安装并集成了 PHP/PHP-FPM,Nginx 可以运行 PHP 脚本。

在使用 Fedora 24 时,应该记住它是一个过时的版本,不再更新或修复。强烈建议使用接受安全修复的最新版本或其他 Linux 发行版,以获得更好的数据安全性和设备兼容性。

总之,Fedora 24 可以手动设置或使用安装程序脚本来提供可靠的 Web 服务器环境,可用于托管动态网站、开发在线应用程序并有效管理数据库。

The above is the detailed content of Configuring Nginx, MariaDB and PHP/PHP-FPM on Fedora 24 servers and workstations. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!