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: Virtual Host driving me nuts....
Author
Bob B.



Joined: 06 Jul 2006
Posts: 10

PostPosted: Sun 17 Sep '06 4:39    Post subject: Virtual Host driving me nuts.... Reply with quote

I have Apache2.2 running on Windows NT. Here is my Virtual Host blocks:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/docs/www.civilwarfakes.com
ServerName www.civilwarfakes.com
CustomLog /www/docs/www.civilwarfakes.com/access.log combined
ErrorLog /www/docs/www.civilwarfakes.com/error.log
</VirtualHost>


<VirtualHost *:80>
DocumentRoot /www/docs/www.scspublications.com
ServerName www.scspublications.com
CustomLog /www/docs/www.scspublications.com/access.log combined
ErrorLog /www/docs/www.scspublications.com/error.log
</VirtualHost>

I have 2 domains on a single IP address. civilwarfakes.com works fine. But when I want to visit scspublications.com, I get civilwarfakes.com index.htm page in the browser instead. For some reason, sbspublications.com always defauts to civilwarfakes.com

To verify my DNS were resolving correctly, I changed the config to listen to both ports 80 and 8080. I then changed the second virtual host block to 8080. I put in the URL scspublications.com:8080/index.htm and then got the correct page.

This setting, ServerName bob.civilwarfakes.com:80 is in the config but I believe the virtual host block overides it. I read somewhere in the Apache Docs. that SeverName in the first virtual host block should match the default SeverName but I tried that also and it didn't make a difference.

Any help would be appreciated.

Bob B.
Back to top
Jorge



Joined: 12 Mar 2006
Posts: 376
Location: Belgium

PostPosted: Sun 17 Sep '06 10:37    Post subject: Reply with quote

Code:
<VirtualHost www.civilwarfakes.com:80>
DocumentRoot /www/docs/www.civilwarfakes.com
ServerName www.civilwarfakes.com
CustomLog /www/docs/www.civilwarfakes.com/access.log combined
ErrorLog /www/docs/www.civilwarfakes.com/error.log
</VirtualHost>


<VirtualHost www.scspublications:80>
DocumentRoot /www/docs/www.scspublications.com
ServerName www.scspublications.com
CustomLog /www/docs/www.scspublications.com/access.log combined
ErrorLog /www/docs/www.scspublications.com/error.log
</VirtualHost>

Try this instead
Back to top
Bob B.



Joined: 06 Jul 2006
Posts: 10

PostPosted: Sun 17 Sep '06 16:45    Post subject: Getting closer thanks to you Reply with quote

Thanks to your suggested changes, I'm getting closer.
Now I get the "docs" directory instead of the subfolder:
"Index of /
www.civilwarfakes.com/
www.scspublications.com/ "

Any other suggestion?

Bob
Back to top
Bob B.



Joined: 06 Jul 2006
Posts: 10

PostPosted: Sun 17 Sep '06 16:50    Post subject: Forgot to mention... Reply with quote

Forgot to mention. I didn't see NameVirtualHost in your suggestion so I removed it.

Bob
Back to top
Bob B.



Joined: 06 Jul 2006
Posts: 10

PostPosted: Sun 17 Sep '06 17:11    Post subject: Update Reply with quote

Since with your changes, I got the docs directory, I changed the DocumentRoot near the top of the config page from:
DocumentRoot "C:/www/docs/"
to:
DocumentRoot "C:/www/docs/www.civilwarfakes.com"

Now I am back to the original problem where both urls go to civilwarfakes.com

Bob
Back to top
Jorge



Joined: 12 Mar 2006
Posts: 376
Location: Belgium

PostPosted: Sun 17 Sep '06 18:03    Post subject: Reply with quote

Oh sry NameVirtualHost should still be used.
Back to top
Bob B.



Joined: 06 Jul 2006
Posts: 10

PostPosted: Sun 17 Sep '06 23:54    Post subject: Reply with quote

This may help. This error was in the scspublications error log:

"[Sun Sep 17 17:30:15 2006] [error] (OS 11004)The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for. : Could not resolve host name www.scsbublications.com -- ignoring!"

Guess it might help if you could see my httpd.conf file. I put it on a website so it would be easier to check:

http://cwrelics.com/httpd.htm

Thanks again,

Bob
Back to top
Bob B.



Joined: 06 Jul 2006
Posts: 10

PostPosted: Mon 18 Sep '06 2:15    Post subject: That didn't do any good.... Reply with quote

Sorry but because of the "<" in the config, it dropped a lot of lines on the web page so I removed most of the comments so it wouldn't be so large:


ThreadsPerChild 250
MaxRequestsPerChild 0


ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"


Listen 80

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so

ServerAdmin info@civilwarfakes.com

ServerName bob.civilwarfakes.com:80

#DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
DocumentRoot "C:/www/docs"

#PHPIniDir "C:/PHP/"

<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Satisfy all
</Directory>

#<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
<Directory "C:/www/docs">
Options Indexes FollowSymLinks ExecCGI Includes MultiViews

AllowOverride All
Order allow,deny
Allow from all
</Directory>


<IfModule dir_module>
DirectoryIndex index.php index.html index.html.var index.cgi
</IfModule>
###########################################################
AccessFileName .htaccess


###########################################################

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>

ErrorLog logs/error.log

LogLevel error

<IfModule log_config_module>

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>

CustomLog logs/access.log common

</IfModule>

<IfModule alias_module>

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
# ScriptAlias /php/ "c:/php/"

</IfModule>

#
# "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever

your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options FollowSymLinks ExecCGI
Order allow,deny
Allow from all
</Directory>


ScriptInterpreterSource registry

DefaultType text/plain

<IfModule mime_module>

TypesConfig conf/mime.types

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script ExecCGI .cgi .pl
# AddType application/x-httpd-php .php
AddType text/html .shtml .shtm
AddOutputFilter INCLUDES .shtml .shtm
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
# For PHP 5
#ScriptAlias /php/ "c:/PHP/"
AddType application/x-httpd-php .php .php3 .phps
Action application/x-httpd-php "/php/php-cgi.exe"

NameVirtualHost www.civilwarfakes.com:80

<VirtualHost www.civilwarfakes.com:80>
DocumentRoot /www/docs/www.civilwarfakes.com
ServerName www.civilwarfakes.com
CustomLog /www/docs/www.civilwarfakes.com/access.log combined
ErrorLog /www/docs/www.civilwarfakes.com/error.log
</VirtualHost>

NameVirtualHost www.scspublications.com:80

<VirtualHost www.scsbublications.com:80>
DocumentRoot /www/docs/www.scspublications.com
ServerName www.scspublications.com
CustomLog /www/docs/www.scspublications.com/access.log combined
ErrorLog /www/docs/www.scspublications.com/error.log
</VirtualHost>
Back to top
Bob B.



Joined: 06 Jul 2006
Posts: 10

PostPosted: Mon 18 Sep '06 5:32    Post subject: Figured it out Reply with quote

Had two NameVirtualHost entries. Removed the second and now both site come up.

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/docs/www.civilwarfakes.com
ServerName www.civilwarfakes.com
CustomLog /www/docs/www.civilwarfakes.com/access.log combined
ErrorLog /www/docs/www.civilwarfakes.com/error.log
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /www/docs/www.scspublications.com
ServerName www.scspublications.com
CustomLog /www/docs/www.scspublications.com/access.log combined
ErrorLog /www/docs/www.scspublications.com/error.log
</VirtualHost>

Thanks for your help.
Back to top


Reply to topic   Topic: Virtual Host driving me nuts.... View previous topic :: View next topic
Post new topic   Forum Index -> Apache