( Virtual Hosts ) Apache2 Configuration Steps

Server Side

root@28cf3aec9d2e:~# apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   May  4 2016 17:05:10
root@28cf3aec9d2e:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.4 LTS"
root@28cf3aec9d2e:~# uname -por
4.6.4-301.fc24.x86_64 x86_64 GNU/Linux
root@28cf3aec9d2e:~# nano /etc/apache2/sites-available/example.conf
<VirtualHost *:80>
ServerName example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example
ErrorLog ${APACHE_LOG_DIR}/example.log
CustomLog ${APACHE_LOG_DIR}/example.log combined
</VirtualHost>
root@28cf3aec9d2e:~# a2ensite example.conf
Enabling site example.
To activate the new configuration, you need to run:
  service apache2 reload
root@28cf3aec9d2e:~# service apache2 reload
root@28cf3aec9d2e:~# mkdir /var/www/example
root@28cf3aec9d2e:~# echo "<?php echo '<h1>example.com , it\'s Works..</h1>'; ?>" > /var/www/example/index.php

Workstation Side

webdev@localhost:~# echo "SERVER_IP  example.com" >> /etc/hosts
webdev@localhost:~# firefox example.com

Comments

Popular Posts