Forum Moderators: phranque
I'm trying to set up Virtual Hosts and can't get beyond this point. Below is all the info I can think of for you to help me find the error. Thanks in advance. All suggestions are welcome and will be testet.
C:/Program Files/Apache Software Foundation/Apache2.2/log/error_log (from latest restart):
[Tue Dec 12 15:29:27 2006] [error] [client 127.0.0.1] client denied by server configuration: D:/htdocs/
[Tue Dec 12 15:30:10 2006] [error] [client 127.0.0.1] client denied by server configuration: D:/htdocs/
[Tue Dec 12 15:31:15 2006] [notice] Parent: Received restart signal -- Restarting the server.
[Tue Dec 12 15:31:15 2006] [notice] Child 2428: Exit event signaled. Child process is ending.
[Tue Dec 12 15:31:15 2006] [notice] Apache/2.2.3 (Win32) PHP/5.2.0 configured -- resuming normal operations
[Tue Dec 12 15:31:15 2006] [notice] Server built: Jul 27 2006 16:49:49
[Tue Dec 12 15:31:15 2006] [notice] Parent: Created child process 292
[Tue Dec 12 15:31:15 2006] [notice] Child 292: Child process is running
[Tue Dec 12 15:31:16 2006] [notice] Child 2428: Released the start mutex
[Tue Dec 12 15:31:16 2006] [notice] Child 292: Acquired the start mutex.
[Tue Dec 12 15:31:16 2006] [notice] Child 292: Starting 250 worker threads.
[Tue Dec 12 15:31:17 2006] [notice] Child 2428: Waiting for 250 worker threads to exit.
[Tue Dec 12 15:31:17 2006] [notice] Child 2428: All worker threads have exited.
[Tue Dec 12 15:31:17 2006] [notice] Child 2428: Child process is exiting
[Tue Dec 12 15:31:17 2006] [notice] Child 292: Starting thread to listen on port 80.
The server is running, there is no syntax errors in the httpd.conf file, the "root" C:/Program Files/Apache Software Foundation/Apache2.2/httpd/index.html works fine in a browser, both from outside and on http*://localhost
httpd -k restart works fine
I'm trying to setup Virtual hosts
NameVirtualHost 123.123.123.123:80
<VirtualHost www.mydomain.com:80>
ServerName www.mydomain.com
ServerAlias mydomain.com
ServerAdmin mail@mycompany.com
DocumentRoot "D:/htdocs/www.mydomain.com"
ErrorLog D:/logs/mydomain/error_log
TransferLog D:/logs/mydomain/access_log
</VirtualHost>
I can access the "root" by typing www.mydomain.com (and any other domain DNS'ed to the server) in my browser and
I can access the "root" by typing in any of the 8 IP's DNS'ed to the server in my browser.
httpd -w
<OS 10013>An attemp was made to access a socket in a way forbidden by its access permissions. : make_sock: could not bind to address 123.123.123.123:80
no listening socket available, shutting down
Unable to open logs
httpd -D DUMP_VHOSTS
123.123.123.123:80 is a NameVirtualHost
default server www.mydomain.com <C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:504>
port 80 namevhost www.mydomain.com <C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:504>
Syntax OK
httpd -S
VirtualHost configuaration:
123.123.123.123:80 is a NameVirtualHost
default server www.mydomain.com <C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:504>
port 80 namevhost www.mydomain.com <C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:504>
Syntax OK
httpd -t
Syntax OK
The most common cause of this problem on Windows is that you've got the IIS server running, and it has already bound port 80. Therefore, Apache cannot connect to a listening port, and therefore, can't do *anything*.
Try Stopping the IIS service, or remove it entirely using Control Panel->Add or Remove Programs->Add/Remove Windows Components.
(I *did* have to refer to the previous thread to find out what OS you're using) :)
Jim
IIS is not installed.
The apache server is running and the index.html from C:/Program Files/Apache Software Foundation/Apache2.2/httpd/ does show.
I was worried by this:
From the log:
[Tue Dec 12 15:29:27 2006] [error] [client 127.0.0.1] client denied by server configuration: D:/htdocs/
In VirtualHost I changed DocumentRoot from D:/htdocs to C:/Program Files/Apache Software Foundation/Apache2.2/httpd/www.mydomain.com
but httpd -w still gives the error:
<OS 10013>An attemp was made to access a socket in a way forbidden by its access permissions. : make_sock: could not bind to address 123.123.123.123:80
no listening socket available, shutting down
Unable to open logs
"Client denied by server configuration" implies that you've got access restrictions imposed by mod_access or mod_rewrite. Look for "Deny from all" or similar in httpd.conf, and comment it out temporarily if found.
Jim
httpd -w
<OS 10048>Only one usage of each socket address (protoco/network address/port) is normally permitted. : make_sock: could not bind to address 123.123.123.123:80
no listening sockets available, shutting down
Unable to open logs
IIS is not installed. Is there a way to check if I have more instanses of apache running?
Are you sure your IP address is 123.123.123.123? I didn't read the previous post, so I'm not sure if you told us what your IP address is (for privacy reasons, you probably didn't...)
Also, why not use
NameVirtualHost *:80
instead? That binds itself to any IP with the port 80.
then your VirtualHost tag is
<VirtualHost *:80>
In Apache 1.3, I know there was a quirk that made the VirtualHost IP:Port exactly match the NameVirtualHost IP:Port. Not sure if that exists in 2.2
Sometimes, Skype and the other VOIP-like software make use of port 80. Just throwing out ideas.
.
httpd -w
(No error message)
httpd -t
Syntax OK
httpd -D DUMP_VHOSTS
Lists the two VirtualHosts I have set up correctly
Syntax OK
netstat -b
(4 entries)
Local Address myserver:microsoft-de
Foreign Address WIN2K:3136
State Established
Local Address myserver:ms-wbt-server
Foreign Address myisp:1933
State Established
Local Address myserver:1506
Foreign Address server31:netbios-sen
State TIME_WAIT
Local Address myserver:1507
Foreign Address server31:netbios-sen
State TIME_WAIT
error_log
no errors on restart
Result:
VHOST1: www.mydomain.com shows the apache server root index page (It Works!), not the specified index page for the VHOST
VHOST2: www.myseconddomain.com is not accessable - "Server not found or DNS error"
For me it looks like the port :80 problem is solved and the error is somewhere ind the httpd.conf file, which don't have syntax errors.
As far as I have read, the httpd.conf file is read from top down, and the order in which the directives are liste does matter.
The suggestion from eqalm *:80 did not make any differnce. I don't have skype, voip or any other service at the server, except the remote connection ms-wbt-server
httpd.conf (short list, in this order)
ThreadsPerChild 250
MaxRequestsPerChild 0
ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"
Listen 80
LoadModule (list of loaded modules)
ServerAdmin mail@mycompany.com
ServerName myserver (veryfied correct servername)
UseCanonicalName Off
HostNameLookups Off
DocumentRoot "D:/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
# Deny from all (outcommented temporarily for test purpose, suggested by jdMorgan)
Satisfy all
</Directory>
<Directory "D:/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Default settings for error, cgi-bin, etc.
NameVirtualHost 123.123.123.123:80
<VirtualHost 123.123.123.123:80>
ServerName www.mydomain.com
ServerAlias mydomain.com
ServerAdmin mail@mycompany.com
DocumentRoot "D:/htdocs/www.mydomain.com"
ErrorLog D:/logs/mydomain/error_log
TransferLog D:/logs/mydomain/access_log
</VirtualHost>
NameVirtualHost 123.123.123.124:80
<VirtualHost 123.123.123.124:80>
ServerName www.myseconddomain.com
ServerAdmin mail@mycompany.com
DocumentRoot "D:/htdocs/www.myseconddomain.com"
ErrorLog D:/logs/myseconddomain/error_log
TransferLog D:/logs/myseconddomain/access_log
</VirtualHost>
The choice of a "main" server in that example is arbitrary, and won't make any practical difference.
Alternatively, "IP-based virtual hosting" as shown at [httpd.apache.org...] may be more like what you want.
Jim
Now I'm again stuck with httpd -w
make_sock: could not bind to address 123.123.123.123:80
no listening socket available, shutting down
Unable to open logs
I'll keep looking for new suggestions in this post, and thanks to all who takes time to help me out, I'll read some more and keep trying
ipconfig/all:
IP Routing Enabled....: No
Wins Proxy Enabled....: No
IP Address...: the one I use
Subnet Mask..: 255.255.255.0
+ the other IP addresses on the machine.
Nothing in the error log.
BUT
At httpd -k restart the server is restarting using the httpd.conf file with my alterations (VirtualHost) with no errors in the log file.
At httpd -k stop the server stops
At httpd -k start nothing happens untill I use the httpd.conf from the /conf/default/ library. Then it starts and shows no errors in the logfile.
So I guess I have to go through the httpd.conf file again from the default version, using stop and start commands instead of restart.
Thanks a lot!
Both for "my" httpd.conf with VirtualHost and for the "default" httpd.conf
It's a stand alone apache server installed by my ISP, Apache 2.2.3 on Win XP pro
PHP 5 and MySql server is also installed on the machine, nothing else.
It will cost me $200 an hour if the ISP did install the server correctlty, nothing if they made an error, I'm considering to remove the apache installation (Control panel --> ad/remove programs) and make another installation.
httpd -k uninstall and httpd -k install works fine. httpd -k config shows no errors.
It Works!
Starting out from the beginning changing one thing at a time and ending up having a simple VirtualHost configuration:
NameVirtualHost 123.123.123.123
<VirtualHost 123.123.123.123>
DocumentRoot D:/htdocs/www.mydomain.com
ServerName www.mydomain.com
</VirtualHost>
Did the trick.
Sometimes, the default Apache installs on some systems (like SUSE 10.1) are so complicated, I feel like ripping it out and just doing a clean install b/c all the config files are everywhere and they have configurations running that I have no idea about.
Anyway, I'll end my diatribe. I wish you good Apache luck with your server. =)
-George