Mikkel Damgaard

< All Topics
Print

Install Apache Webserver on Ubuntu

This very simple guide will help you setup a simple Apache webserver on ubuntu linux with no configuration. Apache is a well supported by alot of applications and is definetly a must for web server administrators to know about

Step 1: Update and Upgrade

This will make sure that all your packages are up to date aswell as the package libary.

sudo apt update && sudo apt upgrade -y 

Step 2: Install Apache

This is the installation command for apache2, this will install apache from Ubuntu’s package libary

sudo apt install apache2  -y 

Step 3: Allow Apache in ufw Firewall:

Allow incomming traffic for apache, to ensure your website is accesable
Use UFW status to control whether or not the rule was added correctly, alternatively you can disable or enable the firewall if nessesary 

sudo ufw allow 'Apache'
sudo ufw status

Step 4: Creating a Custom Web Page:

View edit or create a new configuration file for your webpage. Do it by changing the directory to where Apache stores the configuration files. Copy an existing apache host file and configure it to fit you needs, Alternatively you can create your own from scratch. 

cd /etc/apache2/sites-availiable
# To make a copy of an existing configuration run:
cp <document_to_copy> <some_file_name.conf>
# To create a new file 
namo <some_file_name.conf>
# Alternatively you can use touch to just create the file without editing without 
touch <some_file_name.conf>

Step 5: Edit the configuration

Edit the configuration to your fit your needs. You can read more about the difrent options in the virtual host file here

Tags:
Table of Contents

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top