Results 1 to 4 of 4

Thread: name based virtual hosting

Hybrid View

  1. #1
    Newbie
    Join Date
    Jul 2005
    Location
    india
    Posts
    5

    name based virtual hosting

    i want to configure name based virtual hosting.
    suppose my ip address is 100.101.102.103
    i would like to have 3 websites on the same ip.
    www.abc.com
    www.xyz.com
    www.efg.com
    the default directory is /var/www/html. what are the changes i need to do in the /etc/named.conf and /var/named/<forward-zone> and /var/named/<reverse-zone> files ?

    i have pasted concerned lines of my httpd.conf file. what modifications i need to do in this file ?


    ### Section 3: Virtual Hosts
    #
    # VirtualHost: If you want to maintain multiple domains/hostnames on your
    # machine you can setup VirtualHost containers for them. Most configurations
    # use only name-based virtual hosts so the server doesn't need to worry about
    # IP addresses. This is indicated by the asterisks in the directives below.
    #
    # Please see the documentation at
    # <URL:http://httpd.apache.org/docs-2.0/vhosts/>
    # for further details before you try to setup virtual hosts.
    #
    # You may use the command line option '-S' to verify your virtual host
    # configuration.

    #
    # Use name-based virtual hosting.
    #
    #NameVirtualHost *:80
    #
    # NOTE: NameVirtualHost cannot be used without a port specifier
    # (e.g. :80) if mod_ssl is being used, due to the nature of the
    # SSL protocol.
    #

    #
    # VirtualHost example:
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for requests without a known
    # server name.
    #
    #<VirtualHost *:80>
    # ServerAdmin webmaster@dummy-host.example.com
    # DocumentRoot /www/docs/dummy-host.example.com
    # ServerName dummy-host.example.com
    # ErrorLog logs/dummy-host.example.com-error_log
    # CustomLog logs/dummy-host.example.com-access_log common
    #</VirtualHost>

  2. #2
    Newbie
    Join Date
    Aug 2005
    Location
    Dallas
    Posts
    1
    create respective directores in /var/www/html ( or where ever you want, one for each host )

    make sure all the domain names resolve to your IP i.e nslookup on all your domains gives you your IP ( same IP, since you have only one )

    and add this at the end of your httpd.conf

    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerAdmin webmaster@abc.com
    DocumentRoot /www/html/abc/
    ServerName abc.com
    ErrorLog logs/abc.com-error_log
    CustomLog logs/abc.com-access_log common
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin webmaster@xyz.com
    DocumentRoot /www/html/xyz/
    ServerName xyz.com
    ErrorLog logs/xyz.com-error_log
    CustomLog logs/xyz.com-access_log common
    </VirtualHost>
    <VirtualHost *:80>
    ServerAdmin webmaster@abc.com
    DocumentRoot /www/html/efg/
    ServerName efg.com
    ErrorLog logs/efg.com-error_log
    CustomLog logs/efg.com-access_log common
    </VirtualHost>

    restart apache.

    HTH

    PS: I have assumed that your domain names are resolved to your IP, In that case you dont need to do anything to your DNS configuration

  3. #3
    Senior Member
    Join Date
    May 2004
    Location
    Pakistan
    Posts
    253

    Re:

    Dear jkmartha,
    Hello,

    FYI, http://httpd.apache.org/docs/1.3/vhosts/name-based.html

    Best Regards.
    Frrkh hmd

  4. #4
    Newbie
    Join Date
    Jul 2005
    Location
    india
    Posts
    5
    thanx

Similar Threads

  1. Transition from Windows-based network to Linux-based
    By larynx in forum Linux - Hardware, Networking & Security
    Replies: 3
    Last Post: 03-04-2011, 02:41 PM
  2. FTP server with virtual hosting
    By kumarsaran in forum Linux Distros
    Replies: 5
    Last Post: 08-12-2010, 06:44 AM
  3. Issues creating a VLans using virtual NICs (Virtual-hosts)
    By knight72 in forum Linux - Hardware, Networking & Security
    Replies: 0
    Last Post: 11-19-2005, 11:37 PM
  4. Name Based Virtual Host help
    By datamike in forum Linux - General Topics
    Replies: 3
    Last Post: 12-27-2002, 11:19 PM
  5. Php  virtual hosting script!!
    By in forum Programming
    Replies: 0
    Last Post: 03-01-2002, 05:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •