logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Subdomain configuration in Windows 7 - Apache 2.2.25
Author
weby



Joined: 03 May 2014
Posts: 2
Location: Romania

PostPosted: Sun 04 May '14 15:39    Post subject: Subdomain configuration in Windows 7 - Apache 2.2.25 Reply with quote

Hello,

In my computer (Windows 7 Ultimate) I host my sites with Apache 2.2.25 - mod_fcgid-2.3.6-win32-x86 and PHP 5.4.28.
In "httpd-vhosts.conf" file from Apache I have my domain set as follows and work fine (http://www.example.com or http://example.com):

Code:
<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot "D:/Apache22/vhosts/Example"
    ServerName example.com
    ServerAlias www.example.com *.example.com
    ErrorLog logs/example.com-error.log
    CustomLog logs/example.com-access.log common
  <Directory "D:/Apache22/vhosts/Example">
        Options FollowSymLinks Includes +ExecCGI
        AddOutputFilterByType DEFLATE text/html
        AllowOverride All
        Order Deny,Allow
        Allow from all
  </Directory>
</VirtualHost>


And I set up a subdomain as follows:

Code:
<VirtualHost *:80>
    ServerAdmin director@example.com
    DocumentRoot "D:/Apache22/vhosts/DirectorExample"
    ServerName director.example.com
    ServerAlias www.director.example.com *.director.example.com
    ErrorLog logs/director.example.com-error.log
    CustomLog logs/director.example.com-access.log common
  <Directory "D:/Apache22/vhosts/DirectorExample">
        Options +Indexes FollowSymLinks Includes +ExecCGI MultiViews
        AddOutputFilterByType DEFLATE text/html
        AllowOverride All
        Order Deny,Allow
        Allow from all
  </Directory>
</VirtualHost>


But when I tried to access the page: http://www.director.example.com or http://director.example.com, I was redirected to the page http://www.example.com.
I have DNS configured for "example.com" and "director.example.com". This sites is live in another server.
Error.log files for "director.example.com" and Apache is empty.
How can I configure the subdomain to work?
Can anyone help me?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 05 May '14 16:40    Post subject: Reply with quote

I think your issue is that you cat all subdomains in the first vhost with *.example.com

Using a default vhost for all incoming request that don't belong to a configured vhost might help

See http://httpd.apache.org/docs/2.2/vhosts/examples.html#default
Back to top
weby



Joined: 03 May 2014
Posts: 2
Location: Romania

PostPosted: Mon 05 May '14 17:26    Post subject: Reply with quote

Hello,

My "httpd-vhosts.conf" file look like this:

NameVirtualHost *:80

This is my default vhost:
Code:

   <VirtualHost *:80>
     DocumentRoot "D:/Apache22/htdocs"
     ServerName localhost
     ErrorLog "logs/error.log"
     CustomLog "logs/access.log" common
   </VirtualHost>

This is my domains:

Code:
<VirtualHost *:80>
    ServerAdmin webmaster@example1.com
    DocumentRoot "D:/Apache22/vhosts/Example1"
    ServerName example1.com
    ServerAlias www.example1.com *.example1.com
    ErrorLog logs/example1.com-error.log
    CustomLog logs/example1.com-access.log common
  <Directory "D:/Apache22/vhosts/Example1">
    Options +Indexes FollowSymLinks Includes +ExecCGI MultiViews
    AddOutputFilterByType DEFLATE text/html
    AllowOverride All
    Order Deny,Allow
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot "D:/Apache22/vhosts/Example"
    ServerName example.com
    ServerAlias www.example.com *.example.com
    ErrorLog logs/example.com-error.log
    CustomLog logs/example.com-access.log common
  <Directory "D:/Apache22/vhosts/Example">
        Options FollowSymLinks Includes +ExecCGI
        AddOutputFilterByType DEFLATE text/html
        AllowOverride All
        Order Deny,Allow
        Allow from all
  </Directory>
</VirtualHost>

http://www.example.com or http://example.com and http://www.example1.com or http://example1.com work fine,

<VirtualHost *:80>
    ServerAdmin director@example.com
    DocumentRoot "D:/Apache22/vhosts/DirectorExample"
    ServerName director.example.com
    ServerAlias www.director.example.com *.director.example.com
    ErrorLog logs/director.example.com-error.log
    CustomLog logs/director.example.com-access.log common
  <Directory "D:/Apache22/vhosts/DirectorExample">
        Options +Indexes FollowSymLinks Includes +ExecCGI MultiViews
        AddOutputFilterByType DEFLATE text/html
        AllowOverride All
        Order Deny,Allow
        Allow from all
  </Directory>
</VirtualHost>

This is my "httpd-vhosts.conf" file.
What can I do?
Thanks for reply.
Back to top


Reply to topic   Topic: Subdomain configuration in Windows 7 - Apache 2.2.25 View previous topic :: View next topic
Post new topic   Forum Index -> Apache