0

How to add a domain name to XAMPP in Linux

Posted October 22nd, 2009 in ubuntu and tagged , , , , by Gevork


This short tutorial will guide you in using virtual hosts with XAMPP.

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl.
This tutorial is written in Ubuntu and XAMPP for Linux 1.6.6, 2008/2/11.

First we have to activate virtual hosts in httpd.conf.

1.$ sudo vim /opt/lampp/etc/httpd.conf

Uncomment this line in httpd.conf.

1.Include etc/extra/httpd-vhosts.conf

Next you have to add your virtual hosts to httpd-vhosts.conf.

1.$ sudo vim /opt/lampp/etc/extra/httpd-vhosts.conf

Add your vhost project to httpd-vhosts.conf

1.<VirtualHost *:80>
2. DocumentRoot /opt/lampp/htdocs/vhostdemo
3. ServerName vhostdemo
4.</VirtualHost>

Add a test-file

1.$ sudo vim /opt/lampp/htdocs/vhostdemo/index.php

Add some dummy content to test

Add vhostdemo to your hosts file

1.$ sudo vim /etc/hosts

Add a line with 127.0.0.1 and the name of your vhost project

1.127.0.0.1 vhostdemo

(Re)start your XAMPP server

1.$ sudo /opt/lampp/lampp restart

Start your browser to test if your virtual host works

1.$ firefox http://vhostdemo

Leave a Reply