The Guide shows you Step-by-Step How to Create a Virtual Host in Ubuntu Apache Web-Server Step-by-Step.
The content of the Guides give Focus only to the Essentials Instructions and Commands for an easier understanding ;)
-
Login as SuperUser
sudo su
If Got “User is Not in Sudoers file” then see: How to Enable sudo
-
Installing Apache Server
apt-get update
apt-get install apache2
-
Edit /etc/hosts
nano /etc/hosts
Append:
127.0.0.1 domainname.ext
Ctrl+x to Save and Exit.
-
Make a Virtual Host File in /etc/apache2/sites-available
cd /etc/apache2/sites-available
nano domainname.ext
Insert something like:
ServerName domainname.ext
ServerAlias www.domainname.ext
ServerAdmin email@domainname.ext
DocumentRoot /var/www/domainname.ext
Ctrl+x to Save and Exit.
-
Make a Symlink of File in /etc/apache2/sites-enabled
cd /etc/apache2/sites-enabled
ln -s ../sites-available/domainname.ext .
-
Restart Apache
service apache2 restart