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: Multiple vhosts 2 work/2 dont
Author
Ctechinfo



Joined: 09 Mar 2013
Posts: 3
Location: Augusta, ME

PostPosted: Sun 10 Mar '13 5:04    Post subject: Multiple vhosts 2 work/2 dont Reply with quote

I have several sites I am working on, and to do the intial coding/testing I have my desktop and laptop setup with server software so I can get things tweaked without reeking havoc on the live sites (as bad).

When I was using XAMPP for Windows, the domains (actually subdomains of localhost) all worked as intended. But since switching over to Apache/PHP/MySQL, two work and two don't... (The two that don't fallback to the first site's content but has the correct name in the address bar..


Code:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/ctechinfoNEW"
    ServerName ctechinfo.localhost
    ServerAlias ctechinfo.localhost
    ErrorLog "logs/ctechinfo.localhost-error.log"
    CustomLog "logs/ctechinfo.localhost-access.log" combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/dslwebserverNew"
    ServerName domain4.localhost
    ServerAlias dslwebserver.localhost
    ErrorLog "logs/domain4.localhost-error.log"
    CustomLog "logs/domain4.localhost-access.log" combined
</VirtualHost>

//The following two are the ones that fallback and show the content for the first in the list.

<VirtualHost *:80>
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/timberindustryinformationNEW"
    ServerName timberindustryinfo.localhost
    ServerAlias timberindustryinfo.localhost
    ErrorLog "logs/timberindustryinfo.localhost-error.log"
    CustomLog "logs/timberindustryinfo.localhost-access.log" combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/emachineupgraders"
    ServerName emachineupgraders.localhost
    ServerAlias emachineupgraders.localhost
    ErrorLog "logs/emachineupgraders.localhost-error.log"
    CustomLog "logs/emachineupgraders.localhost-access.log" combined
</VirtualHost>

Any help would be grately appreciated..

Mod note: removed config comments added code tags
Back to top
James Blond
Moderator


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

PostPosted: Mon 11 Mar '13 17:33    Post subject: Reply with quote

Which hosts do works, which don't? We are not that good in guessing.
Back to top
pstimpel



Joined: 09 Mar 2013
Posts: 4
Location: DE

PostPosted: Mon 11 Mar '13 17:39    Post subject: Reply with quote

James Blond wrote:
Which hosts do works, which don't? We are not that good in guessing.
He pointed it out in the comments
Back to top
Ctechinfo



Joined: 09 Mar 2013
Posts: 3
Location: Augusta, ME

PostPosted: Tue 12 Mar '13 12:15    Post subject: Reply with quote

pstimpel wrote:
James Blond wrote:
Which hosts do works, which don't? We are not that good in guessing.
He pointed it out in the comments
Correct..

The timberindustry domain and the emachineupgraders domain are the two that do not work..
Back to top
glsmith
Moderator


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

PostPosted: Tue 12 Mar '13 23:09    Post subject: Reply with quote

I'm assuming the main host (in httpd.conf) has a document root of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs. If not, change this to match.

I would add a default (fallback) vhost as the first vhost in my config. It only needs a docroot since it will catch everything not configured later.


NameVirtualHost *:80

<VirtualHost _default_:80>
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
</VirtualHost>


<VirtualHost *:80>
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/ctechinfoNEW"
ServerName ctechinfo.localhost
...
Back to top
Ctechinfo



Joined: 09 Mar 2013
Posts: 3
Location: Augusta, ME

PostPosted: Wed 13 Mar '13 14:59    Post subject: Reply with quote

hmm tried that, didn't work either..

will mess with it again later today/tonight when I wake up (work nights/sleep most of the day)
Back to top


Reply to topic   Topic: Multiple vhosts 2 work/2 dont View previous topic :: View next topic
Post new topic   Forum Index -> Apache