Author |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Sun 04 Sep '16 23:37 Post subject: Virtual Hosts Will Not Resolve |
|
|
I am trying to use Apache 2.2 on Windows Server 2012. The installation is running. I can connect to Apache using the IP address but only get "It Works" in spite of the fact that I have configured (correctly ???) some Virtual Hosts. Previously my website was on Widows Server 2003 and Apache 1.3 and I had no problem with Virtual Hosts resolving. I have no clue as to what I have done incorrectly. Here's a look at the configuration:
NameVirtualHost xx.yy.zz.xyz:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost xx.yy.zz.xyz:80> ## something.website.com
DocumentRoot E:/pinnacle/website/htdocs/website/Country/Argentina
ServerAdmin admin@website.com
ServerName something.website.com
ServerAlias *.something.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/webbsite/logs/access.log combined
</VirtualHost>
<VirtualHost xx.yy.zz.xyz:80>## website.com
DocumentRoot E:/pinnacle/website/htdocs/
ServerAdmin admin@website.net
ServerName www.website.com
ServerAlias *.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/website/logs/access.log combined
</VirtualHost>
I have tried this in the httpd conf and httpd-vhosts files without success. Obviously I am doing something wrong. As a beginner with Apache I really need some help. Thanks!!! |
|
Back to top |
|
spser
Joined: 29 Aug 2016 Posts: 97
|
Posted: Mon 05 Sep '16 3:54 Post subject: |
|
|
<VirtualHost *:80> ## * Recommended to replace
DocumentRoot E:/pinnacle/website/htdocs/website/Country/Argentina
ServerAdmin admin@website.com
ServerName website.com ## not is www.
ServerAlias test.something.website.com ## Must write complete |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Mon 05 Sep '16 18:47 Post subject: Virtual Hosts Will Not Resolve |
|
|
OK, here's what I have now.
#
NameVirtualHost *:80
<VirtualHost *>
DocumentRoot E:/pinnacle/website/htdocs/website/Country/Argentina
ServerAdmin admin@website.com
ServerName Argentina.website.com
ServerAlias *.argentina.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/website/logs/access.log combined
</VirtualHost>
<VirtualHost *>
DocumentRoot E:/pinnacle/website/htdocs/
ServerAdmin admin@website.com
ServerName website.com
ServerAlias *.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/website/logs/access.log combined
</VirtualHost>
The dns is pointed to the server IP address for both website.com and *.website.com. When connecting via argentina.website.com the "It Works" message comes up. When connecting via website.com a 'Cannot Connect' message comes up. When connecting using the server IP address the "It Works message comes up.
What is going on? Why can I not get the website indexes to appear? They are present within the HTDOCS and everything worked fine with Apache 1.3. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Mon 05 Sep '16 22:40 Post subject: |
|
|
<SoapBox>
First off, why are you trading a 8 year past End-Of-Life Apache version for a new one that is going to basically End-Of-Life in less than a year?
Server 2012 R2 go to 2.4, now is the opportune time. Sure you have to get used to the new access (no Order/Allow/Deny/Satisfy) but it is the time to do it.
</SoapBox>
I remember 1.3, it seems to me what I see as missing in this would also stop 1.3 from working correctly as well.
From the 1.3 docs for name based vhosts
Quote: | If you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host. |
18 years after that was written I still don't like this note much though this one does say what to do. It's a existing web server with a basic configuration out of the compiler to begin with so why not just say what needs to be done and show a full example. There have been a few revisions to this note over the years, making it more prominent or reworded and I think it's latest form is the worst yet.
If they just showed what they mean in a full example, that would make this sooooo much easier and you don't even need the ServerName as the note said.
Code: | NamedVirtualHost *:80>
# Default host, answers IP or any hostname not configure below
<VirtualHost _default_:80>
DocumentRoot /path/to/Apache/htdocs
</VirtualHost> |
Now add yours below that.
Once you have this and your stuff included /Apache22/htdocs will be the default host. The _default_ just informs you of this and it's valid, you can use * if you want instead of _default_.
Now,
(*.)argentina.website.com will go to E:/pinnacle/website/htdocs/website/Country/Argentina
(*.).website.com will go to E:/pinnacle/website/htdocs/
IP address or any hostname that is not configured by a virtualhost block will go to "It Works!"
I put a script in my _default_ document root, any request with an unknown hostname will get a screen that says "There is no website at this address." A request to just the my IP will kindly tell you to "Go Away". |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Wed 07 Sep '16 1:29 Post subject: Virtual Hosts Will Not Resolve |
|
|
Thanks for the feedback. Here's what I have now:
# Virtual hosts
NameVirtualHost *:80
<VirtualHost _default_:80>
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
</VirtualHost>
<VirtualHost *> ## usa.website.com
DocumentRoot E:/pinnacle/website/htdocs/website/Country/USA
ServerAdmin admin@website.com
ServerName usa.website.com
ServerAlias *.usa.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/website/logs/access.log combined
</VirtualHost>
<VirtualHost *> ##website.com
DocumentRoot E:/pinnacle/website/htdocs/
ServerAdmin admin@diversitylink.net
ServerName website.com
ServerAlias *.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/website/logs/access.log combined
</VirtualHost>
I tried to restart Apache from services and it failed. Then I opened a window in Apache Bin and ran httpd.exe -w-e debug. Got the following following message:
[debug] mod_so.c(246): loaded module setenif_module
[warn] NameVirtualHost *:80 has no VirtualHosts
How can this be? More help is needed as I don't have a clue! Thanks! |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 07 Sep '16 7:13 Post subject: |
|
|
is httpd-vhosts.conf included in httpd.conf? or is it commented out? |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Wed 07 Sep '16 16:59 Post subject: Virtual Hosts Will Not Resolve |
|
|
It was commented out and the VirtualHosts noted are in httpdconf. If I 'un-comment' the 'include' line what needs to go in the httpdconf file and what needs to go in the 'httpd vhosts' file? I have never seen anything so _____ confusing! |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Thu 08 Sep '16 1:46 Post subject: Virtual Hosts Will Not Resolve |
|
|
Installed Apache 2.2 again and it is now running. However still no success with Virtual Hosts. The httpd-vhosts line is un-commented in the httpd conf. file and here's what's in the vhosts file:
# Virtual hosts
NameVirtualHost *:80
<VirtualHost _default_:80>
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
</VirtualHost>
<VirtualHost *80> ## usa.website.com
DocumentRoot E:/pinnacle/website/htdocs/website/Country/USA
ServerAdmin admin@website.com
ServerName usa.website.com
ServerAlias *.usa.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/website/logs/access.log combined
</VirtualHost>
<VirtualHost *80> ##website.com
DocumentRoot E:/pinnacle/website/htdocs/
ServerAdmin admin@diversitylink.net
ServerName website.com
ServerAlias *.website.com
ScriptAlias /cgi-bin/ "E:/pinnacle/website/cgi-bin/"
<Directory "E:/pinnacle/website/htdocs">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride all
Order allow,deny
Allow from all
</Directory>
ErrorLog E:/pinnacle/website/logs/error.log
CustomLog E:/pinnacle/website/logs/access.log combined
</VirtualHost>
IP addressing yields "It Works". Wesite addressing yields the same thing. What am I doing wrong? |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Thu 08 Sep '16 1:58 Post subject: Virtual Hosts Will Not Resolve |
|
|
Here's what I get at the Apache error l
[error][client my IP]File does not exist: C:/Program Files (86) Apache Software Foundation/Apache 2.2/htdocs/favicon.ico, referer: http://website.com/ |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 19 Sep '16 13:58 Post subject: |
|
|
That is jsut a not found "error" of the favicon ico file. Not a real issue. |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Mon 19 Sep '16 17:55 Post subject: Virtual Hosts Will Not Resolve |
|
|
Fixed the cause of the noted error. Still, nothing works! Any assistance will be appreciated. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 20 Sep '16 16:39 Post subject: Re: Virtual Hosts Will Not Resolve |
|
|
MiltSpain1 wrote: | Still, nothing works! Any assistance will be appreciated. |
What does not work yet? You can open the website on the new server? Still get the old server? |
|
Back to top |
|