2

I'm trying to start an instance of Apache 2.2 server with a fairly-close-to-standard configuration file. I made one small change because I want Apache to serve a single XML file separately from everything else it does, purely for testing on my local machine. The change is that I inserted this into httpd.conf:

# Based on http://httpd.apache.org/docs/2.2/vhosts/examples.html

Listen 10.11.12.13:85

NameVirtualHost 10.11.12.13:85

<VirtualHost 10.11.12.13:85>
DocumentRoot "C:\foo\bar"
ServerName www.MyCompanyMyProjectFooBarTestURL.com
</VirtualHost>

Attempting to start Apache resulted in this:

(OS 10049)The requested address is not valid in its context. : make_sock: could not bind to address 10.11.12.13:85
no listening sockets available, shutting down
Unable to open logs

No instances of Apache are running. Nothing is using port 85 (or 80 or 8080). There's nothing special about 10.11.12.13:85; I just figured that was an IP that wouldn't interfere with anything.

What does this error mean, and how can I resolve it?

5 Answers 5

3

There could be reason the IP address you are pointing is generic one. For example:-10.1.1.233:443 And you get error >>> (OS 10049)The requested address is not valid in its context. : make_sock: could not bind to address 10.1.1.233:443

comment the line in httpd-ssl.conf and start the Apache

2

Make sure that the IP is configured on an network interface that is UP.

To add an IP to a network interface on Windows 7 you can follow the HOWTO from http://www.pctips3000.com/how-to-assign-more-than-one-ip-address-to-one-lan-in-windows-7/

If you have DHCP, then you might need to do some Registry tricks like: http://www.petri.co.il/configure_tcp_ip_to_use_dhcp_and_a_static_ip_address_at_the_same_time.htm or just use static IP allocation.

3
  • Could you elaborate? I don't understand this. (If it's not obvious, this is my first time trying to do anything with Apache.)
    – Pops
    Sep 21, 2011 at 20:00
  • @LordTorgamus Is that IP address configured on the system, not just in Apache? Apache can't bind to a port on an IP that the system doesn't have configured anywhere. Sep 21, 2011 at 20:30
  • Hm, no. I didn't realize I'd need to configure it elsewhere just to use it locally. Could you give me a search term to start with? I'm getting a lot of "set up your home router!" results in Google at the moment. @ShaneMadden
    – Pops
    Sep 21, 2011 at 20:41
1

in CMD , type: ipconfig, and see your local IP address. then set this one instead of unknown 10.11.12.13:85

1

Since nobody has yet explained what is going on:

Apache cannot bind to the local IP address you gave, because the computer is not configured with that IP address.

There are a couple of ways to solve this:

  1. You can Listen to an IP address that the computer actually has. But keep in mind that specifying an IP address restricts incoming connections, and only other hosts which can reach that address will be able to access the server, and only via that address. For a production web server on the Internet, this is almost always not what you want, so...

  2. Don't specify an IP address in the Listen directive. Apache will then listen to all interfaces for incoming connections. If it doesn't matter where the connections come from, such as a publicly accessible web server or one which is properly firewalled, then this is the simplest solution.

-1

In order to find a socket to bind to you can point to the local machine address. That seems to change when you turn the computer off and on. To find the local address in use, go into control panel, network and sharing center, click on the wireless connection, then on the "details" button, and the IPv4 address should be the local machine address. You can add this address and a good socket like 8088 to httpd.conf as a "Listen" parameter - e.g. Listen 127.0.0.1:8088 (that is a default localhost but your IP will be different) - you can list more than one of these addresses and it will bind to one that is free. This works in windows. Then add the same IP address to the hosts file.

1
  • Correction - the hosts file only needs the localhost IP address of 127.0.0.1 Also, the system will try to bind to the first IP listed under "Listen" and if it does not work the system will not bind and will display an error and close apache. I'm not sure if this is the best way do do things, but I'm just listing whatever address the system is using based on the IPv4 address ... which means you have to change the httpd.conf file whenever that address changes.
    – user252558
    Nov 5, 2014 at 23:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .