Create a quick Apache web server in Linux
Local website
We will start this web server with a simple web page that will be viewable from the local network.
Installing Apache
Update packages
- This is necessary when installing any Linux program
- "-y" will automatically accept any prompts
- Your local IP address is the address of the web server
- Visit the IP address in a browser to view Apache's landing page
- I.E: http://192.168.1.215/
sudo apt-get update -y
✂
Install Apache2
sudo apt install apache2 -y
✂
Open the firewall for Apache
sudo ufw allow "Apache Full"
✂
View your website locally
ip address | awk '/inet / {print $2}'
✂
Editing your site
Edit the default page
- We will back up and rename the original default page
- We will use nano as the text editor
- Press Ctrl+o then Enter to save in Nano
- Press Ctrl+x to escape back to the Terminal
sudo mv /var/www/html/index.html /var/www/html/apache2_default_page.html
✂
sudo nano /var/www/html/index.html
✂
Copy this code into the text editor and save