Skip to main content
Ask me k`no`w queries , I will tell you k`no`w lies

Sharing Name based Virtual Host over LAN

Create project folder in your webserver folder #

My webserver is Apache
for eg: i created 'our_project' folder in my server i.e /home/auto-w24/public_html/

Creating named Vhost #

In Ubuntu
Create a file in /etc/apache/sites-available folder with the name of you Vhost for eg:ourserver.local.
Now open the newly craeted ourservre.local file and enter following content.

<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName ourserver.local ServerAlias www.ourserver.local
DocumentRoot /home/auto-w24/public_html/our_project SetEnv APPLICATION_ENV "development" Options FollowSymLinks AllowOverride None <Directory /home/auto-w24/public_html/our_project> Options Indexes FollowSymLinks MultiViews DirectoryIndex index.php AllowOverride All Order allow,deny allow from all ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128
Make modifications to your requirements

In terminal

sudo a2ensite ourserver.local

Changes to /etc/hosts file

Open your /etc/hosts file and following line to it

127.0.0.1 ourserver.local www.ourserver.local

Restart apache webserver

Now you should be able access our_project folder in browsesr if you type ourserver.local or www.ourserver.loacl

Settings to access 'our_project' in other systems connecting same network #

In linux ststems like Ubuntu #

Lets assume System-1 as the system in which we have all the above settings and System-2 is a ubuntu system connected to the same network as system-1.

In System-1 find your IP address.

Let us assume System-1 IP is 00.00.00.00

In System-2 open /etc/hosts file and add following line to it

00.00.00.00 ourserver.local www.ourserver.local

Save the file

Now you can access our_project from System-2 in browser by typing either ourserver.local or www.ourserver.local

In windows systems #

Open the hosts file in windows/system32/drivers/ folder

Add following line to it

00.00.00.00 ourserver.local www.ourserver.local

Save the file

Now you can access 'our_project' from this windows system in browser by typing either ourserver.local or www.ourserver.local

In OSX Snow leopard systems #

Open the hosts file private/etc/hosts

Add following line to it

00.00.00.00 ourserver.local www.ourserver.local

Save the file

Now you can access 'our_project' from this system in browser by typing either ourserver.local or www.ourserver.local