Skip to content

bibinmv/Linux-Web-Server-Deployment-Monitoring-Security

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 

Repository files navigation

Linux Web Server Deployment, Monitoring & Security using LAMP Stack

📌 Project Overview

This project demonstrates how to deploy, monitor, and secure a production-style Linux web server environment using AlmaLinux.

The setup includes:

  • LAMP Stack Deployment
  • Infrastructure Monitoring using Prometheus and Grafana
  • Apache Virtual Hosting
  • Linux Server Security Hardening

This project showcases practical Linux System Administration and Monitoring skills.


🏗 Architecture

Component Tool
Operating System AlmaLinux
Web Server Apache
Database MariaDB
Backend Language PHP
Monitoring Prometheus
Visualization Grafana
Metrics Exporter Node Exporter
Security Firewalld, Fail2Ban, SSH Hardening, SELinux

📦 Project Components


1️⃣ LAMP Stack Deployment

Installed Apache, MariaDB, and PHP to host web applications.

Install Packages

# Install Apache
dnf install httpd -y
# Install MariaDB
dnf install mariadb-server -y
# Install PHP
dnf install php -y
# Install PHP MySQL Native driver(for PHP-MariaDB connection)
dnf install php-mysqlnd -y

Start Services

systemctl enable --now httpd
systemctl enable --now mariadb

Allow HTTP in Firewall

Because Apache runs on port 80, the firewall must allow it.

firewall-cmd --permanent --add-service=http
firewall-cmd --reload

Verify Installation

php -v
mysql --version
systemctl status httpd

Test Web Server

Create a simple HTML page to verify that Apache is serving web content.

echo "Welcome to my Linux Web Server Project" > /var/www/html/index.html

You can also create the file using vim:

vim /var/www/html/index.html

Open in browser:

http://SERVER-IP

Screenshot

LAMP Web Server

2️⃣ Server Monitoring (Prometheus + Grafana)

Installed Prometheus, Node Exporter, and Grafana to monitor the Linux server and visualize system metrics.


Monitoring Tools

  • Prometheus
  • Node Exporter
  • Grafana

Install Node Exporter

Step 1: Install wget

dnf install wget -y

Step 2: Navigate to the opt directory

cd /opt

Step 3: Download Node Exporter from GitHub

wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz

Step 4: Extract the archive

tar -xzf node_exporter-1.7.0.linux-amd64.tar.gz

Step 5: Start Node Exporter

cd node_exporter-1.7.0.linux-amd64
./node_exporter &

Install Prometheus

Step 1: Navigate to the opt directory

cd /opt

Step 2:Download Prometheus from GitHub

wget https://github.com/prometheus/prometheus/releases/download/v2.52.0/prometheus-2.52.0.linux-amd64.tar.gz

Step 3:Extract the archive:

tar -xzf prometheus-2.52.0.linux-amd64.tar.gz

Step 4:Start Prometheus:

cd prometheus-2.52.0.linux-amd64
./prometheus &

Install Grafana

Step 1: Install the Grafana RPM package from Grafana Labs

dnf install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-10.4.2-1.x86_64.rpm

Step 2: Start and enable Grafana service

systemctl enable --now grafana-server

Metrics Monitored

  • CPU Usage
  • Memory Usage
  • Disk Usage
  • Network Traffic
  • System Load
  • System Uptime

Node Exporter Metrics

Node Exporter exposes Linux system metrics for Prometheus.

Access Node Exporter metrics:

http://SERVER-IP:9100/metrics

Screenshot

Node Exporter Metrics


Prometheus Targets

Prometheus scrapes metrics from configured targets.

Access Prometheus interface:

http://SERVER-IP:9090

Verify that node_exporter is listed and showing UP.

Screenshot

Prometheus Targets


Grafana Dashboard

Grafana was configured to use Prometheus as the data source.

Dashboard used:

Node Exporter Full Dashboard (ID: 1860)

Access Grafana:

http://SERVER-IP:3000

default login:
username: admin
password: admin

Screenshot

Grafana Dashboard

3️⃣ Apache Virtual Hosting

Configured Apache to host multiple websites on a single server using different domain names.

Example Domain Names

site1.local
site2.local

Create Website Directories

mkdir -p /var/www/site1
mkdir -p /var/www/site2

Directory Structure

/var/www/site1
/var/www/site2

Example VirtualHost Configuration

<VirtualHost *:80>
    ServerName site1.local
    DocumentRoot /var/www/site1
</VirtualHost>

<VirtualHost *:80>
    ServerName site2.local
    DocumentRoot /var/www/site2
</VirtualHost>

Reload Apache

systemctl restart httpd

Configure Local DNS (hosts file)

Edit the hosts file:

vim /etc/hosts

Add

192.168.233.135 site1.local
192.168.233.135 site2.local

Testing

curl http://site1.local
curl http://site2.local

Screenshot

Apache Virtual Host Test Apache Virtual Host Test Apache Virtual Host Test

4️⃣ Linux Server Security Hardening

Implemented multiple security measures to improve the security of the Linux web server.


🔐 SSH Hardening

Edited the SSH configuration file to disable insecure login methods.

Edit configuration file:

vim /etc/ssh/sshd_config

Security settings applied:

PermitRootLogin no
PasswordAuthentication no
PermitEmptyPasswords no

Restart SSH service:

systemctl restart sshd

Verify SSH service:

systemctl status sshd

Screenshot

ssh-hardening-verification

🔥 Firewall Configuration

Configured Firewalld to allow required services.

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --permanent --add-service=ssh
firewall-cmd --reload

Verify firewall rules:

firewall-cmd --list-all

Screenshot firewall-rules

🛡 Fail2Ban Intrusion Protection

Installed Fail2Ban to protect the server from brute-force login attacks.

Enable the EPEL repository (required for Fail2Ban):

dnf install epel-release -y

Install Fail2Ban:

dnf install fail2ban -y

Start and enable service:

systemctl enable --now fail2ban

Check Fail2Ban status:

fail2ban-client status

Screenshot fail2ban

🧩 SELinux Verification

Checked SELinux status to ensure security policies are enforced.

getenforce
sestatus

Expected output:

Enforcing

Screenshot selinux-status

🧠 Skills Demonstrated

  • Linux System Administration
  • Web Server Deployment
  • Infrastructure Monitoring
  • Linux Security Hardening
  • Networking & Firewall Configuration
  • Troubleshooting & Diagnostics

⚙ Technologies Used

  • Linux (AlmaLinux)
  • Apache HTTP Server
  • MariaDB
  • PHP
  • Prometheus
  • Grafana
  • Node Exporter
  • Firewalld
  • Fail2Ban
  • SELinux

🎯 Conclusion

This project demonstrates how to deploy, monitor, and secure a Linux-based web server environment using industry-standard tools. It highlights core skills required for Linux System Administration and DevOps roles, including web server deployment, monitoring, security hardening, and infrastructure management.

About

Linux web server project using AlmaLinux: LAMP deployment, Prometheus & Grafana monitoring, Apache virtual hosting, and security hardening.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors