Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
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 understand how to set up Nginx on Fedora 24 Server and Workstation using MariaDB and PHP/PHP-FPM. This combination creates a powerful LEMP stack for managing databases and serving dynamic content.
Note: Fedora 24 is an older version that no longer receives security updates. For production environments, consider using a current Fedora version or other long-term support distributions.
Installation Prerequisites
Before starting, ensure your system is updated and you have root privileges. We'll install the LEMP stack components step by step ?
sudo dnf update sudo dnf install nginx mariadb-server php php-fpm php-mysql
Method 1: Using LEMP Stack Installer Script
The automated approach uses a script to handle installation and configuration. First, install the basic components ?
# Install and start services sudo systemctl start nginx mariadb php-fpm sudo systemctl enable nginx mariadb php-fpm # Download and run installer script wget https://raw.githubusercontent.com/rtCamp/easyengine/master/services/nginx/install.sh sudo chmod +x install.sh sudo bash install.sh
Method 2: Manual Installation
Step 1: Configure Nginx
Edit the Nginx configuration to work with PHP-FPM ?
# Edit /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_index index.php;
}
}
Step 2: Configure MariaDB
Secure your MariaDB installation ?
sudo mysql_secure_installation
Step 3: Test PHP Configuration
Create a PHP info file to verify the setup ?
<?php // Create /var/www/html/info.php phpinfo(); ?>
Step 4: Restart Services
Apply all configurations by restarting services ?
sudo systemctl restart nginx php-fpm sudo nginx -t # Test configuration
Verification
Test your setup by accessing http://localhost/info.php in your browser. You should see the PHP information page displaying your configuration details.
Conclusion
Setting up Nginx with MariaDB and PHP-FPM on Fedora 24 creates a robust web server environment. The manual installation method provides better control over configurations, while the script method offers faster deployment. Remember to use current Fedora versions for production environments to ensure security updates and support.
