top of page
  • Linkedin
  • bluesky
  • Instagram

Apache on Ubuntu Server

  • solbergtonje
  • 16 nov. 2024
  • 2 min läsning

Uppdaterat: 25 dec. 2024

Apache is a popular web server and a part of the LAMP-stack, which you can read about at IBM.


ree


Let's start by updating the package manager cache, run the command "sudo apt update"


ree



Install Apache by running the command "sudo apt install apache2"Write "y" to continue


ree



Apache is now installed, but we need configure the firewall to allow HTTP traffic. Start by listing all available applications by running the command "sudo ufw app list"


ree



To allow traffic on port 80, run the command "sudo ufw allow 'Apache'" and verify the change with the command "sudo ufw status" If the firewall is inactive, run the command "sudo ufw enable" (Apache Full will allow unencrypted traffic on port 80 and encrypted traffic on port 443, while Apache Secure only allows encrypted traffic on port 443)


ree



Check if the web server is up and running with the command "sudo systemctl status apache2" If it is inactive, run the command "sudo systemctl start apache2"


ree



Add a port forwarding rule to the virtual machine for the quickest and easiest way to get access to Apache web server from your host machine. Shutdown Ubuntu Server with the command "init 0"


ree



In the VirtualBox Manager, right-click on your Ubuntu Server and choose "Settings"


ree



Then click on "Network"


ree



Click on "Advanced" and then "Port Forwarding"


ree



Click on the green + button to add a new port forwarding rule


ree



Give the rule a name, and then add "80" under both "Host Port" and "Guest Port" then click "OK", and "OK" again before starting up the Ubuntu Server


ree



Check that Apache is running with the command "sudo systemctl status apache2"


ree



Then open a browser on your host machine and go to https://localhost/


ree



Apache is now installed and ready for configuration, check out the official Apache HTTP Server Documentation here



SOURCES

Apache HTTP Server Documentation: https://httpd.apache.org/docs/2.4/

Contact / Kontaktformulär

© 2024-2025 Tonje Solberg

bottom of page