I'd like to run two websites with XAMPP for Linux on my computer:

  • One for my public website development
  • One for my thesis (bibliography management, abstracts, ...)

They are totally unrelated and I don't want one to run on a sub domain of the other and I don't want to mess with the .htaccess file.

What's the best way to do so ?

  • Do you have domains for them? – Frands Hansen Mar 12 '11 at 10:18
  • Sorry, I'm not sure to understand your question. I'm using a localhost. – Coronier Mar 12 '11 at 10:35
  • I'm trying to configure VirtualHost (httpd-vhosts & /etc/hosts), but it doesn't work. I get a error 500... – Coronier Mar 12 '11 at 10:37
  • Did you read the error log after getting the 500? – Ignacio Vazquez-Abrams Mar 12 '11 at 10:59
  • In error_log, I have: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. – Coronier Mar 12 '11 at 11:46

Just set up your vhosts as is:

Name VirtualHost
<VirtualHost *:80>
   DocumentRoot /www/thesis
   ServerName thesiswork

<VirtualHost test2:80>
   DocumentRoot /www/test2
   ServerName test2

<VirtualHost test3:80>
   DocumentRoot /www/test3
   ServerName test3

Then in your /etc/hosts file just do the following:


That way you can just go to: example.com or test3.example.com (after you make the config changes to hosts makes sure you restart networking.

| improve this answer | |

I recommend a port-based vhosts.conf like this (this is the complete vhosts.conf):

NameVirtualHost *:80

<virtualHost *:80>
DocumentRoot "/var/www/"
ServerName localhost
ServerAdmin admin@localhost

Listen 61 #use random free port number
<virtualHost *:61>
DocumentRoot "/var/vhosts/thesis/"
ServerName asdf
ServerAdmin admin@asdf

You can then call your page with http://localhost/ and your thesis thing with http://localhost:61/

The advantage of port-based over name-based virtual hosting is that you don't need a domain, and you don't need to mess with your hosts file, which I find to be kind of "dirty".

Make sure you allow access to the directory in that you wish to host your thesis file in, for example in your httpd.conf, or just add it to your vhosts.conf:

<Directory "/var/vhosts/">
Order Deny,Allow
Allow From All
AllowOverride All
| improve this answer | |
1 means that and and and ... upto or something like that are available IP addresses to use. So if name based virtual hosts are not good enough, you could have differerent localhost like IP addresses for each website.

| improve this answer | |

You should use a name-based virtual host. Full details are listed here: http://httpd.apache.org/docs/current/vhosts/name-based.html

The basic idea is that you'll set up a default virtualhost on localhost, with something like this:

<VirtualHost _default_:*>
   DocumentRoot /www/default

Then, for your thesis site, you could set up another virtualhost

<VirtualHost *:80>
   DocumentRoot /www/thesis
   ServerName thesiswork

On your local computer, you would then have to edit your /etc/hosts file to include "thesiswork", pointing to

| improve this answer | |

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