How to install and run Apache web server in ubuntu localhost
- Install Apache sudo apt update sudo apt install apache2 Then test it out by typing in our IP address for the web server.
- Creating own website
sudo mkdir /var/www/sitename/
cd /var/www/sitename/
nano index.html
use this code
<title> This is my wedsite! </title>
I'm running this website on an Ubuntu Server!
- Setup VirtualHost cd /etc/apache2/sites-available/ sudo cp 000-default.conf sitename.conf sudo nano sitename.conf Now Edit this file ServerName sitename.com ServerAdmin [email protected] DocumentRoot /var/www/sitename/
- Activating VirtualHost sudo a2ensite sitename.conf service apache2 reload
- SetUp Host name sudo nano /etc/hosts Now Edit: 127.0.0.1 sitename.com
- Disable defalt site sudo a2dissite 000-default.conf service apache2 reload
Now type sitename on you browser. It wis running in localhost.