Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ask my question first and below are details of what I have so far trying to solve the thing:

On Apache running on localhost, I want to have different virtual hosts that would be accessible through url:


So I have Apache running on port 8080 of my laptop. Linux Mint, so Debian distro. Everything is in local for testing purposes, so no DNS involved! The IP address I use is which has the domain of my computer, called fabjoa. On the file /etc/apache2/apache2.conf, I've put:

ServerName fabjoa

In the file /etc/hosts, there is indeed the line fabjoa

In the file /etc/apache2/ports.conf

NameVirtualHost *:8080
Listen 8080

Now, the conf file of my virtual host. The file is called is goyahkla and is located on /etc/apache2/sites-available/ and has a symbolic link in /etc/apache2/sites-enabled. On this file, I have the following:

<VirtualHost *:8080>
 ServerName goyakhla.fabjoa
 ServerAdmin webmaster@localhost
 DocumentRoot /var/sites/goyahkla


<Directory /var/sites/goyahkla/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all



Running apache2ctl configtest gives me Syntax OK. Now, on browser, opening http://fabjoa:8080/ does point to the Virtual Host goyahkla (beacause that's the only one I have), but http://goyahkla.fabjoa:8080 is not found. Other debugging:

telnet goyahkla.fabjoa:8080
telnet: could not resolve goyahkla.fabjoa:8080/telnet: Name or service not known

lynx goyahkla.fabjoa:8080
Looking up  'goyahkla.fabjoa' first
Looking up  '', guessing...

Looking up goyahkla.fabjoa first
Looking up, guessing...
Looking up
Making HTTP connection to
Alert!: Unable to connect to remote host.

lynx: Can't access startfile 

Any idea on how purpose could be achieved?

share|improve this question

I have to create new entries in /etc/hosts for each virtual host.

For example, I've added the following line: goyahkla

Which allows me to access it through

share|improve this answer

What you're looking for is a *.fabjoa style syntax in your hosts file. Unfortunately, the hosts file doesn't support this. You'd have to use DNS for that or enter each one individually like you mentioned above.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.