Apache Webserver in Linux

Web Server Setup - Apache2 on Ubuntu

Update Package Index

# Update package index
sudo apt update
        

Install Apache2

# Install Apache2
sudo apt install apache2
        

Start Apache2 Service

# Start Apache2 service
sudo systemctl start apache2
        

Enable Apache2 Service to Start on Boot

# Enable Apache2 service to start on boot
sudo systemctl enable apache2
        

Configure Firewall

# Allow Apache through firewall
sudo ufw allow 'Apache'
        

Check Apache2 Status

# Check Apache2 status
sudo systemctl status apache2
        

Basic Apache2 Commands

# Restart Apache2 service
sudo systemctl restart apache2

# Stop Apache2 service
sudo systemctl stop apache2
        

Deploy a Simple Website

# Navigate to the web root directory
cd /var/www/html

# Create a sample HTML file
sudo nano index.html

# Example content for index.html



    
    
    My Website
    


    

Welcome to My Website!

This is a simple Apache2 web server setup on Ubuntu.

Post a Comment