Apache2 and Virtual Hosts (VHost)

In this article, i’ll explain you how to set your Apache configuration on SuSE 9.2 to make your local websites visible on you machine. This is particularly useful for people like me who make websites and need to test them on their local machines before publish.

First of all, you need Apache installed on you machine via YaST with eventually PHP and MySql.
After that you’ll have all apache configuration files under /etc/apache2 directory.
The simplest thing you have to do is create a mysites.conf file wherever you want and hardlink it to /etc/apache2/vhosts.d
I created mysites.conf in my public_html for my personal comfort :)

What about mysites.conf content? HERE to you a simple example:

NameVirtualHost *

ServerName localhost ServerAlias linzekus DocumentRoot /srv/www/htdocs DocumentRoot /home/zekus/public_html/ontosofia/ontosophy ServerName ontosophy ServerAdmin [email protected]

Thus, the last thing to do is adding all our virtual servers on /etc/hosts file to make them available. This file is only accessible via root and this is a sample:


hosts This file describes a number of hostname-to-address

mappings for the TCP/IP subsystem. It is mostly

used at boot time, when no name servers are running.

On small systems, this file can be used instead of a

“named” name server.



IP-Address Full-Qualified-Hostname Short-Hostname

# localhost linzekus XXXX <-list all virtual hosts HERE

special IPv6 addresses

::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts

What else now? Point your browser on the URL of your new virtual hosts like that:


Thats all folks!
good setting

comments powered by Disqus