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: Apache 2.4 subdomain setup fails
Author
pivey



Joined: 06 May 2012
Posts: 12
Location: Greece

PostPosted: Sun 07 Oct '12 22:53    Post subject: Apache 2.4 subdomain setup fails Reply with quote

I am struggling with this all the day, no answer i found here as well. Please advice how to setup proper a subdomain i need.

My Apache config has 2 domains configured (on same IP), for the domain2.com i need to setup a sub-domain. Here is what i have so far, but the subdomain keeps redirecting me to domain2.com (main site).

Code:
<VirtualHost 11.11.11.11:80>
ServerName domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot "C:/wwwmap/domain1.com"
</VirtualHost>

<VirtualHost 11.11.11.11:80>
ServerName domain2.com
ServerAlias domain2.com *.domain2.com
DocumentRoot "C:/wwwmap/domain2.com"
</VirtualHost>

        <VirtualHost 46.4.24.4:80>
        ServerName projects.domain2.com
        DocumentRoot "C:/wwwmap/projects"
        </VirtualHost>



The DNS entry is: projects in CNAME domain2.com

Trying to remove ServerAlias domain2.com *.domain2.com worked so far, but then domain2.com is redirecting to domain1.com

What am i doing wrong?
Back to top
James Blond
Moderator


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

PostPosted: Tue 09 Oct '12 23:19    Post subject: Reply with quote

You need to define the projects.domain2.com vhost before the vhost with with wildcard catch domain, than it will work. I know that it is a bit confusing!

{code]
<VirtualHost 11.11.11.11:80>
ServerName domain1.com
ServerAlias *.domain1.com
DocumentRoot "C:/wwwmap/domain1.com"
</VirtualHost>

<VirtualHost 46.4.24.4:80>
ServerName projects.domain2.com
DocumentRoot "C:/wwwmap/projects"
</VirtualHost>

<VirtualHost 11.11.11.11:80>
ServerName domain2.com
ServerAlias *.domain2.com
DocumentRoot "C:/wwwmap/domain2.com"
</VirtualHost>

Just a small advise, you don't have to define the servername a second time (in the ServerAlias)
Back to top
pivey



Joined: 06 May 2012
Posts: 12
Location: Greece

PostPosted: Wed 10 Oct '12 22:31    Post subject: Reply with quote

Thank you very much Mr. Blond Wink

Both for the solution (the only one i could not think of) & the tip for the servername in alias.

I appreciate! Take care
Back to top


Reply to topic   Topic: Apache 2.4 subdomain setup fails View previous topic :: View next topic
Post new topic   Forum Index -> Apache