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: Subdomains Causing crisis
Author
lulzduck



Joined: 02 Jan 2013
Posts: 2

PostPosted: Wed 02 Jan '13 18:55    Post subject: Subdomains Causing crisis Reply with quote

I am running an apache 2.0 server on a windows 7 host machine which is hosting for my domain lulzduck.com. My issue is, when i try and modify the httpd.conf to include my subdomain i want (webmail.lulzduck.com) I can't get it to actually redirect it to the directory containing the webmail files. It will only either, redirect to my main index, or just down everything.

What i have done so far is i uncommented this line:-
LoadModule vhost_alias_module modules/mod_vhost_alias.so

And i have tryed adding varyous varyations of this:-

<VirtualHost 172.0.0.1>
ServerName www.lulzduck.com
ServerAdmin admin@lulzduck.com
DocumentRoot N:/Access/htcdocs/rodents/
ServerAlias webmail.lulzduck.com
</VirtualHost>

I don't know if it's relevant, but my apache is installed in program files (x86) on C and htcdocs is put on my external N drive via an NTFS junction. This setup works fine for everything else, but it may not for this.

I am having a back of my mind feeling that maybe the hosts file on windows is in some way "fucking" with my DNS requests via my loopback interface?
Back to top
DnvrSysEngr



Joined: 15 Apr 2012
Posts: 226
Location: Denver, CO USA

PostPosted: Wed 02 Jan '13 20:54    Post subject: Reply with quote

Hi Lulz:

I too ran into a similar situation when setting up vHosts for the first time. After some tweaking, I finally got it right (with help from others also). Here is my actual working config from my VHosts. Hope this helps.

- Scott

# WWW.MSBEDHOLM.ORG
#
<VirtualHost *:80>
ServerName www.msbedholm.org
ServerAdmin scott@saetek.net
ServerPath "C:/Program Files/Apache/WEB_Sites/MSBEdholm"
DocumentRoot "C:/Program Files/Apache/WEB_Sites/MSBEdholm"
<Directory />
HostnameLookups On
Options FollowSymLinks MultiViews
DirectoryIndex /edholm.php
AllowOverride None
Require all granted
</Directory>
ErrorLog "logs/msbedholm.org-error.log"
CustomLog "logs/msbedholm.org-access.log" common
</VirtualHost>
#
# RESUME.MSBEDHOLM.ORG
#
<VirtualHost *:80>
ServerName resume.msbedholm.org
ServerAdmin scott@saetek.net
ServerPath "C:/Program Files/Apache/WEB_Sites/MSBEdholm"
DocumentRoot "C:/Program Files/Apache/WEB_Sites/MSBEdholm"
<Directory />
HostnameLookups On
Options FollowSymLinks MultiViews
DirectoryIndex /resume.php
AllowOverride None
Require all granted
</Directory>
ErrorLog "logs/resume.msbedholm.org-error.log"
CustomLog "logs/resume.msbedholm.org-access.log" common
</VirtualHost>
Back to top
lulzduck



Joined: 02 Jan 2013
Posts: 2

PostPosted: Wed 02 Jan '13 21:16    Post subject: Reply with quote

Thanks for the reply Scott. I have tried the config you suggested, and it has produced a new error this time lol. This was my modification of it for my domain.


<VirtualHost *:80>
ServerName www.lulzduck.com
ServerAdmin admin@lulzduck.com
ServerPath "N:/Access/htcdocs/"
DocumentRoot "N:/Access/htcdocs/"
<Directory />
HostnameLookups On
Options FollowSymLinks MultiViews
DirectoryIndex /index.php
AllowOverride None
Require all granted
</Directory>
ErrorLog "logs/lulzduck.com-error.log"
CustomLog "logs/lulzduck.com-access.log" common
</VirtualHost>

#
# RESUME.MSBEDHOLM.ORG
#

<VirtualHost *:80>
ServerName webmail.lulzduck.com
ServerAdmin admin@lulzduck.com
ServerPath "N:/Access/htcdocs/rodents/"
DocumentRoot "N:/Access/htcdocs/rodents/"
<Directory />
HostnameLookups On
Options FollowSymLinks MultiViews
DirectoryIndex /index.php
AllowOverride None
Require all granted
</Directory>
ErrorLog "logs/webmail.lulzduck.com-error.log"
CustomLog "logs/webmail.lulzduck.com-access.log" common
</VirtualHost>


And it produced an "error 500 internal" lol. ON all pages. I thought in case it provides additional info, I've left it up for now @http://lulzduck.com Very Happy. could this be related to my hosts file causing silly behavior with DNS resolution to occur? Or perhaps my use of NTFS junctions confusing Apache as to where the files are actually located?
Back to top
DnvrSysEngr



Joined: 15 Apr 2012
Posts: 226
Location: Denver, CO USA

PostPosted: Wed 02 Jan '13 22:20    Post subject: Reply with quote

Lulz:

Mine is on a live/production server. My DNS has:

www.msbedholm.org and resume.msbedholm.org as A records and not Aliases and they are not pointed to loopback/127.0.0.1 addresses.

I will have to try your config on my development server later this evening and see what happens.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 02 Jan '13 22:28    Post subject: Reply with quote

Hmm ... if it 500s, there should be something in the error log.

The usual culprit of problems when using name based vhosting is not repeating the main host first. WTF you say?

if in httpd.conf i have;
ServerName www.mydomain.com
DocumentRoot /path/to/files

...

in httpd-vhosts.conf I have

# First host duplicates main host, only document root needed
<VirtualHost *:80>
DocumentRoot /path/to/files
</VirtualHost>

<VirtualHost *:80>
ServerName other.mydomain.com
DocumentRoot /path/to/other/files
other directives
</VirtualHost>

<VirtualHost *:80>
ServerName another.mydomain.com
DocumentRoot /path/to/another/files
other directives
</VirtualHost>
Back to top
DnvrSysEngr



Joined: 15 Apr 2012
Posts: 226
Location: Denver, CO USA

PostPosted: Thu 03 Jan '13 4:19    Post subject: Reply with quote

I have to agree with Gregg on this one. He is the one who had originally helped me set up my VHosts file awhile back when I went from 2.2 to 2.4.

The directives are the tricky part and they need to be typed in correctly.
Back to top


Reply to topic   Topic: Subdomains Causing crisis View previous topic :: View next topic
Post new topic   Forum Index -> Apache