Bookmark and Share Chat with us on Live Messenger Chat with us on Skype Follow iServices Facebook Profile of iServices MySpace Profile of iServices LinkedIn Profile of Jesse Grobstein LinkedIn Profile of Carla Narciso Login to i Services Private Server
Ninja Mascott We've arrived, and to prove it we're here

    Welcome to our blog!

    Bookmark this page and visit regularly to check for new content and free software recommendations!
    visit volcanoecigs.com for the best eCig starter kits and accessories on the web
« Free J&C phpGallery...online security, what an oxymoron! »

Virtual Host on Apache Server

01/21/09

Permalink 09:16:45 am by i Services, Inc., Categories: Scripts and Codes

FYI: Recently we had an issue configuring virtual hosting on Apache, we found lots of useless information and very little relevant but vague information on the subject. Here's the facts!

Issue: URL not accessible from within the network, local ip directs to wrong folder and localhost directs to the right folder.

Solution: Check your vhosts configuration, in Suse 10.x httpd.conf includes your configuration files to keep things easy to maintain, you'll find listen.conf in /etc/apache2 and your vhosts.conf files in /etc/apache2/vhosts.d; Make sure you have the following configured correctly for named virtual hosting in your listen.conf file:

Listen 80
and at the bottom of the file
NameVirtualHost *
both these lines should be uncommented!

Your vhost.conf file should look something like this working example:


# DERFAULT.COM
<VirtualHost *>
    ServerName default.com
    DocumentRoot /srv/www/htdocs
    ServerAdmin you@yourdomain.com
    HostnameLookups Off
    UseCanonicalName Off
    ServerSignature On
    ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
    <IfModule mod_userdir.c>
   UserDir public_html
   Include /etc/apache2/mod_userdir.conf
    </IfModule>
<Directory "/srv/www/htdocs">
   Options Indexes FollowSymLinks
   Order allow,deny
   Allow from all
</Directory>
</VirtualHost>
# OTHER.COM
<VirtualHost *>
    ServerName other.com
    DocumentRoot /srv/www/vhosts/other.com
    ServerAdmin you@yourdomain.com
    HostnameLookups Off
    UseCanonicalName Off
    ServerSignature On
    ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
<Directory "/srv/www/vhosts/other.com">
   Options Indexes FollowSymLinks
   Order allow,deny
   Allow from all
</Directory>
</VirtualHost>


You can also create a seperate .conf file for each VirtualHost, all .conf files will be included from your vhosts.d directory. Keeping VirtualHost files seperated makes it easier to administer changes on a single domain.

Make sure you correctly set up your DNS or DynDNS to point to your external IP Address and if you are using a router, set up port forwarding to your local machine and check that "Filter Internet NAT Redirection" is NOT ticked under your router security settings.

Restart Apache services and everything should work!

 

A place for us to post information and keep our visitors informed.

User tools

Advertisements

Search

XML Feeds


free open source blog



Home  |   Services  |   Portfolio  |   Our Blog  |   About Us  |   Contact Us

© Copyright 2006 - 2012. i Services, Inc. All rights reserved.