Tanveer’s Weblog

[Apache] Loopback Interface Testing

July 15, 2008 · 2 Comments

Sometimes it’s really important to test multiple websites on localhost. How we can do that? Very easy! ;) .. Yes we can use different port for each site. Some days ago i found one of the windows hosting server did this for their different users. So we can also be able to to it in apache..

What we need is to initialize the port for each site.. here is an example

We need to edit our httpd.conf file and paste these code in the suitable place

Listen 127.0.0.1:8000
Listen 127.0.0.1:1111
BindAddress 127.0.0.1

Port 1111
Port 8000

ServerName 127.0.0.1

NameVirtualHost *

<VirtualHost *:8000>
DocumentRoot “/home/username/test/example.org/htdocs”
<Directory “/home/username/test/example.org/htdocs”>
Options Indexes FollowSymLinks MultiViews
AllowOverride None

Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:1111>
DocumentRoot “/home/username/test/example.com/htdocs/”
<Directory “/home/username/test/example.com/htdocs/”>
Options Indexes FollowSymLinks MultiViews
AllowOverride None

Order allow,deny
Allow from all
</Directory>
</VirtualHost>

done, now port 8000 is for our development and 1111 is for testing purpose

enjoy ;)

Ref: Security Tips for Server Configuration

Categories: Apache · Linux · Tips' n Tricks'
Tagged: ,

2 responses so far ↓

  • David // May 7, 2009 at 3:22 pm | Reply

    Hi Tanveer,
    Really nice example to looping back. Just what i need. btw this blog really has some good resource.
    Nice job you have done so far..
    Keep it up…. ;)

  • Tanveer // May 8, 2009 at 3:28 pm | Reply

    Hi David,
    Thanks a lot… for your compliment ;)

Leave a Comment