Apache will not start - Virtual hosts not working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Apache will not start - Virtual hosts not working

Postby ooper » 04. August 2006 06:32

(Running on Windows XP.)

If I comment out this line in httpd.conf

#Include conf/extra/httpd-vhosts.conf

Apache will start up. If I uncomment it, it will not start. I get this error in the Event Viewer:

The Apache2 service terminated with service-specific error 1 (0x1).

I have another box where I have it working correctly, but I installed everything myself. I just copied the <VirtualHost> settings from the working environment, so they should be fine. Here is my httpd-vhosts.conf file:

NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost:80
ServerAdmin me@here.com
DocumentRoot "C:/Program Files/xampp/htdocs"
ErrorLog logs/error.log
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain1.com
ServerAdmin me@here.com
DocumentRoot "C:/Program Files/xampp/tomcat/webapps/domain1/ROOT/"
ServerAlias domain1.com
ErrorLog @rel_logfiledir@/domain1.com-error_log
CustomLog @rel_logfiledir@/domain1com-access_log common

ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain2.com
ServerAdmin me@here.com
DocumentRoot "C:/Program Files/xampp/tomcat/webapps/domain2/ROOT/"
ServerAlias domain2.com
ErrorLog @rel_logfiledir@/domain2.com-error_log
CustomLog @rel_logfiledir@/domain2.com-access_log common

ProxyPass / http://localhost:8082/
ProxyPassReverse / http://localhost:8082/
</VirtualHost>

Then I have tomcat's server.xml file configured with those connectors. The tomcat side is working fine because I can hit http://localhost:8081/ and http://localhost:8082/ successfully.

I also uncommented these two lines in httpd.conf:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

That's about all I've changed from the default installation of XAMPP. Any ideas why Apache fails to load?

Thanks,
Brian Barnett
ooper
 
Posts: 5
Joined: 04. August 2006 02:15
Location: USA

Postby Izzy » 04. August 2006 07:10

Brian, great imformative post with nothing missing to effect an answer. :)

You may use the command line option '-S' to verify your virtual host configuration. You don't need to stop the server either if it is running to check syntax but obviously if the server won't start then this command will tell you what is wrong. If the syntax is good it will return Syntax OK

Start-Run-cmd.exe
cd path:\to\apache\bin
apache -S


Start-Run-cmd.exe
cd path:\to\apache\bin
apache -t

will check the syntax for the config files.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Got it fixed

Postby ooper » 04. August 2006 16:24

I stopped the apache service and ran apache -S and apache -t at a command prompt. Both return "Syntax OK".

After a bit more troubleshooting, I think I got it figured out. In my virtual hosts, I had copied these lines directly from the examples:

ErrorLog @rel_logfiledir@/domain2.com-error_log
CustomLog @rel_logfiledir@/domain2.com-access_log common

I assumed the @rel_logfiledir@ was some sort of macro, but it looks like that is what was causing the problem. I replaced with this and the problem went away.

ErrorLog logs/domain2.com-error.log
CustomLog logs/domain2.com-access.log common
ooper
 
Posts: 5
Joined: 04. August 2006 02:15
Location: USA

Postby Izzy » 05. August 2006 04:02

Good result, Brian.

Even though that error log syntax was correct it was obviously not pertinent to your situation.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby ooper » 05. August 2006 14:39

Is that error log syntax correct for all operating systems, or is it OS agnostic?
ooper
 
Posts: 5
Joined: 04. August 2006 02:15
Location: USA

Postby Izzy » 05. August 2006 15:36

Not sure as I have not come accross it until I installed XAMPP but here is a sample from a Lunux RedHat 9 Apache server (not XAMPP) and is similar to the way I have my XAMPP configured and just like you have now after your hassle:
Code: Select all
#<VirtualHost *>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 35 guests