Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Virtual Host setup
Results 1 to 7 of 7

Thread: Virtual Host setup

  1. #1

    Virtual Host setup

    Hey everyone. I set up virtual host on my Apache box, well I thought I did, but it does not work. This is my code.

    NameVirtualHost 65.112.18.1**

    <VirtualHost 65.112.18.1**>
    ServerName www.mainsite.com
    DocumentRoot /var/www/html
    </VirtualHost>

    <VirtualHost 65.112.18.1**>
    ServerName www.virtualsite.net
    DocumentRoot /var/www/html/public_html/mike/
    DirectoryIndex index.html
    </VirtualHost>

    I read tons of the Apache pages and it seems like it should work. I added web forwarding through the Netsol GUI so that both domains point to that same IP. Do I need to add other stuff in httpd.conf or somewhere else? The only way I can get it to work is if I web forward to www.mainsite.com/public_html/mike/. But that sucks cuz it leaves the main sites URL instead of the virtual host URL. Hope this makes sense. I can clear up any weirdness. Thanks in advance.


  2. #2
    Mentor
    Join Date
    Jun 2001
    Posts
    1,672

    Re:Virtual Host setup

    I don't know about those **

    Try to set it up like this:

    NameVirtualHost 65.112.18.1:80

    <VirtualHost 65.112.18.1:80>
    ServerName www.mainsite.com
    DocumentRoot /var/www/html
    </VirtualHost>

    <VirtualHost 65.112.18.1:80>
    ServerName www.virtualsite.net
    DocumentRoot /var/www/html/public_html/mike/
    DirectoryIndex index.html
    </VirtualHost>

  3. #3

    Re:Virtual Host setup

    Sorry, I should have said that those were just put in here for my protection. I have the whole IP address in the real code. I do not however have port 80 in the IP address. I will give that a try. Thanks.

  4. #4
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935

    Re:Virtual Host setup

    There are two kinds of virtual hosting, name based and IP based. Depending on the setup you want, it needs to be setup differently.

    In /etc/apache/httpd.conf file
    1. Check your "Listen" section. If you are using port other than 80, it needs to be explicitly uncommented.
    For example
    Code:
    Listen 80
    Listen 85
    Listen 4000
    Listen 192.168.0.40
    Listen 192.168.0.44
    2. You need to have Binding turn on.
    Code:
    # BindAddress * ( will bind all IP on that box )
    BindAddress 192.168.0.40
    BindAddress 192.168.0.44
    3. You need to check NameVirtualHost section. If you are going to use IP based virtual hosting, you need to define it here. If you are for Namebased, see the next section.
    Code:
    NameVirtualHost 192.168.0.40
    NameVirtualHost 192.168.0.44
    4. If you are setting up Name-based one, here is the VirtualHost entry.
    Code:
        NameVirtualHost *
    
        <VirtualHost *>
        ServerName www.your-domain.com
        DocumentRoot /www/your-domain
        </VirtualHost>
    
        <VirtualHost *>
        ServerName www.your-other-domain.com
        DocumentRoot /www/your-other-domain
        </VirtualHost>
    5. If you are setting up IP based, then here is the entry. ( Note- the NameVirtualHost entry is at item 3 ).
    Code:
    <VirtualHost 192.168.0.40>
    ServerAdmin admin@your-domain.com
    DocumentRoot /www
    ServerName www.your-domain.com
    </VirtualHost>
    <VirtualHost 192.168.0.44>
    ServerAdmin another-admin@another-domain.com
    DocumentRoot /www/another-one
    ServerName www.another-domain.com
    </VirtualHost>
    Yeap, it's complicated but once you get it going, it's easier to setup. It took me two days to get it all sort it but once I get what section for what, I don't need to look at the doc ever again. Apache is so much easier than IIS.

    HTH ....

    If you need more help, check it out here.

    http://httpd.apache.org/docs/vhosts/

  5. #5

    Re:Virtual Host setup

    Thanks for all the info. How do you think this looks? I have to wait 24 hours to get Netsol to change the DNS so I am not sure if it worked. I don't need to do anything with the bind IP addresses when I use Name based virtual hosting right?

    Listen 80

    <VirtualHost _default_:80>

    NameVirtualHost *

    <VirtualHost *>
    ServerName www.mainsite.com
    DocumentRoot /var/www/html
    DirectoryIndex index.html
    </VirtualHost>

    <VirtualHost *>
    ServerName www.virtualsite.net
    DocumentRoot /var/www/html/public_html/mike/
    DirectoryIndex index.html
    </VirtualHost>

  6. #6
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935

    Re:Virtual Host setup

    Looks good to me ...

  7. #7
    Senior Member
    Join Date
    May 2001
    Posts
    345

    Re:Virtual Host setup

    I've also used

    <VirtualHost foo.hostname.com> once (when putting two domains on one IP), but I didn't read much docs so I'm not sure how proper it is.

Similar Threads

  1. Apache Rewrite Server & Virtual Host
    By comeaus in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 06-02-2010, 08:26 PM
  2. Virtual host/local host PAM File problem!
    By honey bee in forum Linux - Hardware, Networking & Security
    Replies: 0
    Last Post: 03-01-2006, 01:38 PM
  3. apache virtual host
    By mars in forum Linux - General Topics
    Replies: 1
    Last Post: 01-15-2005, 07:30 AM
  4. VIRTUAL HOST HELP
    By -=amity=- in forum Linux - General Topics
    Replies: 2
    Last Post: 07-17-2004, 07:23 PM
  5. Name Based Virtual Host help
    By datamike in forum Linux - General Topics
    Replies: 3
    Last Post: 12-27-2002, 11:19 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
  •