homepage Welcome to WebmasterWorld Guest from 23.23.22.200
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
VirtualHost on apache 2.2
error_log, httpd -w, httpd -D DUMP_VHOSTS etc.
ulstrup




msg:3187456
 2:15 pm on Dec 13, 2006 (gmt 0)

Continued from [webmasterworld.com...] (which was getting too long due to my incompetence - you don't need to read it to continue)

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

 

jdMorgan




msg:3187472
 2:33 pm on Dec 13, 2006 (gmt 0)

> make_sock: could not bind to address 123.123.123.123:80 no listening socket available, shutting down

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

ulstrup




msg:3187559
 3:33 pm on Dec 13, 2006 (gmt 0)

Thanks 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

jdMorgan




msg:3187564
 3:43 pm on Dec 13, 2006 (gmt 0)

Well, it appears that *something* is bound to port 80 -- Either IIS, another instance of Apache, or some malware program acting as an HTTP server. Shutting down Apache and restarting the machine might help. You can have only one instance of any server bound to a port -- that's the important point here.

"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

ulstrup




msg:3188412
 9:09 am on Dec 14, 2006 (gmt 0)

Did first get a chance to restart this morning, it sure seems to be a socket problem, after restart I get this:

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?

ulstrup




msg:3188551
 12:28 pm on Dec 14, 2006 (gmt 0)

netstat -a:
TCP servername:epmap
TCP servername:microsoft-ds
TCP servername:1027
TCP servername:3306
TCP servername:ms-wbt-server
TCP servername:http
TCP servername:ms-wbt-server
TCP servername:netbios-ssn

Does this show anything already using port 80?

equalm




msg:3188678
 3:53 pm on Dec 14, 2006 (gmt 0)


I don't mean to sound patronizing, because I've done this before.

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.

.

ulstrup




msg:3188693
 4:26 pm on Dec 14, 2006 (gmt 0)

equalm, thanks, any input is welcome. No my IP address is not 123.123.123.123, for privacy reasons as you suggest, I'll try the *:80 option.

ulstrup




msg:3189324
 9:56 am on Dec 15, 2006 (gmt 0)

Thank you for helping me, I'm really trying hard, reading, trying and testing, these are the results so far and my conclusions based on my obviously not sufficient knowledge. Hope someone do have the time and patience to take a look.

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>

jdMorgan




msg:3189505
 2:34 pm on Dec 15, 2006 (gmt 0)

You might want to make a backup of your current configuration, and then try modifying it to look more like the "Name-based hosts on more than one IP address" example shown at
[httpd.apache.org...]

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

ulstrup




msg:3189603
 3:49 pm on Dec 15, 2006 (gmt 0)

Thanks
I've tried every possible variaton of the examples (again)
I tried to change the DocumentRoot from D:/htdocs to C:/Program Files/Apache Software Foundation/Apache2.2/htdocs

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

equalm




msg:3189624
 4:04 pm on Dec 15, 2006 (gmt 0)


A couple things...


make_sock: could not bind to address 123.123.123.123:80

When you type "ipconfig /all" on the server, your address matches what you put into the NameVirtualHost configuration?

And is there any information in the error logs you can show us upon startup?

.

ulstrup




msg:3189752
 5:21 pm on Dec 15, 2006 (gmt 0)

Yes, the IP I use in the NameVirtualHost configuration is listed as IP addresses in the ipconfig/all

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!

equalm




msg:3189851
 6:46 pm on Dec 15, 2006 (gmt 0)


That's really odd.

what happens when you run "httpd -t"

(in linux that runs a configtest)

Not being totally familiar with windows-based apache, are you using standalone apache server, or are you using it as something packaged with another product?

.

ulstrup




msg:3189867
 6:59 pm on Dec 15, 2006 (gmt 0)

httpd -t
Syntax OK

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.

ulstrup




msg:3191924
 12:57 pm on Dec 18, 2006 (gmt 0)

Thanks jdMorgan and equalm

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.

equalm




msg:3192315
 7:14 pm on Dec 18, 2006 (gmt 0)


Glad to hear it. When I do an install of Apache for myself on a system, i usually clear out the defaults (or comment them out usually) and put in my configs just so I know EXACTLY what I'm getting into.

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved