Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6950023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:02:25+00:00 2026-05-27T14:02:25+00:00

I created 2 virtual hosts http:// web1.com:2107 pointing to /var/www/web1 folder and second http://

  • 0

I created 2 virtual hosts http:// web1.com:2107 pointing to “/var/www/web1” folder and second http:// web2.com:2107 pointing to “/var/www/web2”. all subdomains in web2 are working fine, But in case of web1.com:2107 i am able to see only home page. when i try to open any subdomain from web1 like http:// games.web1.com:2107 it points to web2’s home page ie /var/www/web2/ directory

Is there anything wrong in configuration ?

below is the code for hosts i am using

<VirtualHost *:80>
ServerName  web2.com
ServerAdmin myeow@web2.com
ServerAlias http://www.web2.com
DocumentRoot /var/www/web2
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory /var/www/web2>
    Options Indexes FollowSymLinks Multiviews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride All
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog    /var/www/web2/error80.log
CustomLog   /var/www/web2/access80.log Combined
</VirtualHost>

<VirtualHost *:2107>
ServerName  web2.com    
ServerAdmin myeow@web2.com
ServerAlias http://www.web2.com
DocumentRoot /var/www/web2
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory /var/www/web2>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride All
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

    ErrorLog /var/www/web2/error.log
CustomLog   /var/www/web2/access80.log Combined
LogLevel warn

CustomLog /var/log/apache2/web2.com_access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

===================================================================

NameVirtualHost *:2107
<VirtualHost *:2107>
    ServerName web1.com
    ServerAlias http://web1.com
    DocumentRoot /var/www/web1
    <Directory /var/www/web1/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
    </Directory>
    ErrorLog        /var/www/web1/error.log
    CustomLog       /var/www/web1/access.log Combined
</VirtualHost>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:02:26+00:00Added an answer on May 27, 2026 at 2:02 pm

    When you have several VirtualHosts one of them is the default VirtualHost.
    It’s the first one in alphabetic order of the file containing the definition of the VirtualHost.

    When you remove a VirtualHost. If you still have an entry in the Hosts file or a DNS record, when the query is performed on your Apache server, if it cannot find the right VirtualHost (ServerName or ServerAlias), then the default one is taken to process the answer.

    When you add a new VirtualHost, if you make a mistake in the ServerName or ServerAlias you’ll also have the default VH.

    Update

    Now that the question is complete I can see you are not using ServerAlias in the right way. All your subdomains should be listed in ServerAlias directives, without the http://
    So you should have:

    ServerName web1.com
    ServerAlias www.web1.com
    ServerAlias games.web1.com
    

    You could maybe try a *.web1.com.
    Else when you use a name which is not listed the default vhost is used (and here vhost web2.com is defined before so it’s the default one on this port)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a project student in /var/www/ But I am unable to access it
I created a virtual directory for my php app. Now I get the Directory
I have created a web service in a virtual directory using VS 2008. I
Is it possible to create a virtual folder in IIS from an ASP.NET site?
i am wondering if i am doing some thing wrong i have http://localhost pointing
I have installed symfony sandbox 1.2 and created a virtual host by modifying apache
I using XAMPP and I have configure it in order to have virtual hosts
How to connect two virtual machine(Ubuntu) created by VMware Player in different Host Machines?
i have Apache 2.2 and 3 virtual hosts on it and a mod_rewrite infinite
I have my website in /var/www/invent. I have zend-framework in /var/www/invent/library. Basically what i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.