RaineyM
asked on
Trouble with Virtual Hosts - Moving From Linux to Win32
I have recently moved my Apache web server to a new W2K box from a Red Hat Linux box. I have everything working as it should except that I cannot get the virtual hosts working. The virtual hosts worked perfectly on the Linux box, but every time I try them in a browser from the W2K box I get a 404 error.
Also when I run "Test Configuration", I receive the following error:
Warning: DocumentRoot [/www/docs/headcase/webroo t] does not exist
Syntax OK
Listed below is the <VirtualHost> segment of my httpd.conf:
Remember, this worked on the Linux Box.
<VirtualHost *>
ServerName headcase.dyndns.org
ServerAlias *.headcase.dyndns.org
ServerAdmin 'emailAddress'
DocumentRoot /www/docs/headcase/webroot
<Directory /www/docs/headcase/webroot >
Options Indexes Includes FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php default.php index.htm default.htm index.html default.html
HostnameLookups Off
ErrorLog www/docs/headcase/logs/err or_log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog www/docs/headcase/logs/acc ess_log combined
ServerSignature On
ScriptAlias /cgi-bin/ "/www/docs/headcase/cgi-bi n/"
<Directory "/www/docs/headcase/cgi-bi n">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi .pl
AddType application/x-httpd-php .php
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
Alias /error/ "/www/docs/headcase/error/ "
<Directory "/www/docs/headcase/error" >
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html php
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en cs de es fr it nl sv pt-br ro
ForceLanguagePriority Prefer Fallback
</Directory>
</IfModule>
</IfModule>
</VirtualHost>
Also when I run "Test Configuration", I receive the following error:
Warning: DocumentRoot [/www/docs/headcase/webroo
Syntax OK
Listed below is the <VirtualHost> segment of my httpd.conf:
Remember, this worked on the Linux Box.
<VirtualHost *>
ServerName headcase.dyndns.org
ServerAlias *.headcase.dyndns.org
ServerAdmin 'emailAddress'
DocumentRoot /www/docs/headcase/webroot
<Directory /www/docs/headcase/webroot
Options Indexes Includes FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php default.php index.htm default.htm index.html default.html
HostnameLookups Off
ErrorLog www/docs/headcase/logs/err
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog www/docs/headcase/logs/acc
ServerSignature On
ScriptAlias /cgi-bin/ "/www/docs/headcase/cgi-bi
<Directory "/www/docs/headcase/cgi-bi
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi .pl
AddType application/x-httpd-php .php
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
Alias /error/ "/www/docs/headcase/error/
<Directory "/www/docs/headcase/error"
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html php
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en cs de es fr it nl sv pt-br ro
ForceLanguagePriority Prefer Fallback
</Directory>
</IfModule>
</IfModule>
</VirtualHost>
ASKER
On my W2K box, the ServerRoot I left as the default on the install:
"C:/Program Files/Apache Group/Apache2"
And according to my httpd.conf above, it should see the 'webroot' directory if "C:/Program Files/Apache Group/Apache2/www/docs/hea dcase/webr oot" exists, and it does exist but does not see it.
When I put in <VirtualHost 123.1.123.111> it goes to my default webpage, not to the virtually-hosted one.
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- --------
When on my linux box, the ServerRoot I have is:
"/etc/apache2"
And according to my httpd.conf above, it should see the 'webroot' directory if "/etc/apache2/www/docs/hea dcase/webr oot" exists, and it does exist and it sees it fine.
I have it all except for the "DocumentRoot" statement.
"C:/Program Files/Apache Group/Apache2"
And according to my httpd.conf above, it should see the 'webroot' directory if "C:/Program Files/Apache Group/Apache2/www/docs/hea
When I put in <VirtualHost 123.1.123.111> it goes to my default webpage, not to the virtually-hosted one.
--------------------------
When on my linux box, the ServerRoot I have is:
"/etc/apache2"
And according to my httpd.conf above, it should see the 'webroot' directory if "/etc/apache2/www/docs/hea
I have it all except for the "DocumentRoot" statement.
ASKER
OK, now I am getting the following from my server:
Not Found
The requested URL / was not found on this server.
-------------------------- ---------- ---------- ---------- ---------- ---------- ----
Apache/2.0.47 (Win32) PHP/4.3.3 DAV/2 Server at headcase.dyndns.org Port 80
Not Found
The requested URL / was not found on this server.
--------------------------
Apache/2.0.47 (Win32) PHP/4.3.3 DAV/2 Server at headcase.dyndns.org Port 80
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
PS: after change httpd.conf, you need to restart apache (or reboot your box)
ASKER
2. Define your mainhost as a VirtualHost as well (you can put it as your first VirtualHost, just make a few records for the mainhost)
Helped out with the main site. Thanks.
But, for some odd reason, you have to specify the full path, i.e.; "C:\Program Files\Apache Group\Apache2\..." in each line that requires a path in the <virtualhost> directive.
Beats me.
<hangs head in utter befuddlement>
Helped out with the main site. Thanks.
But, for some odd reason, you have to specify the full path, i.e.; "C:\Program Files\Apache Group\Apache2\..." in each line that requires a path in the <virtualhost> directive.
Beats me.
<hangs head in utter befuddlement>
"for some odd reason, you have to specify the full path, i.e.; "C:\Program Files\Apache Group\Apache2\..." in each line that requires a path in the <virtualhost> directive."
It is normal, you have to use FULL PATH for <virtualhost> </Directory>, that's apache !!!
Cheers!
It is normal, you have to use FULL PATH for <virtualhost> </Directory>, that's apache !!!
Cheers!
I am having the same problem. Moved off of RedHat to Win2k Server. New httpd.conf file. My virtual hosts still points to the main site, not the correct virtual hosts.
# Use name-based virtual hosting.
#
NameVirtualHost www.wallafamily.org:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost>
ServerAdmin BLANKED FOR PRIVACY
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/walla "
ServerName www.wallafamily.org
ErrorLog logs/walla.com-error_log
CustomLog logs/walla.com-access_log common
</VirtualHost>
Anyone see what is wrong?
# Use name-based virtual hosting.
#
NameVirtualHost www.wallafamily.org:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost>
ServerAdmin BLANKED FOR PRIVACY
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/walla
ServerName www.wallafamily.org
ErrorLog logs/walla.com-error_log
CustomLog logs/walla.com-access_log common
</VirtualHost>
Anyone see what is wrong?
ASKER
Try putting the domain name inside the <VirtualHost> tag, like <VirtualHost www.wallafamily.com:80>.
Next, try putting * for NameVirtualHost and changing the directory and point it to one outside htdocs, like "C:/Program Files/Apache Group/Apache2/www/docs/wal la", for example. I tried mine inside htdocs and it just pointed everybody to the default site.
Next, try putting * for NameVirtualHost and changing the directory and point it to one outside htdocs, like "C:/Program Files/Apache Group/Apache2/www/docs/wal
1. From what I seen in you httpd.conf file, you did not put the VirtualHost IP in the file,
it should be something like:
<VirtualHost 123.1.123.111> # just put your REAL IP.
2. Make sure that you have a DNS record for the VirtualHost.
3. Check all the dir path, you make sure they are correct