Httpd – no listening sockets available while starting httpd

centos6httpd

Our server is configured with an internal IP. Then in the firewall, the admins mapped a valid IP address (2.X.Y.Z). So, the ipconfig command shows

eth1      Link encap:Ethernet  HWaddr 00:E0:61:36:D5:34
          inet addr:172.20.54.10  Bcast:172.20.54.255  Mask:255.255.255.0
          inet6 addr: fe80::270:81ef:fec6:d534/64 Scope:Link

However, we use ssh 2.X.Y.Z. Now, I want to setup the apache web server in order to enter 2.X.Y.Z in the web browser. So, I opened /etc/httpd/conf/httpd.conf and modified

Listen 2.X.Y.Z:80
Listen 80

I replaced the XYZ with the numbers. Problem is, when I restart the httpd, I get this error

Starting httpd: (99)Cannot assign requested address: make_sock: could not bind to address 2.X.Y.Z:80
no listening sockets available, shutting down
Unable to open logs
                                                       [FAILED]

UPDATE 1:

If I replace Listen 2.X.Y.Z with Listen 172.20.54.10, then I get this error

Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                       [FAILED]

If I comment that line, the service will be started. However, in the browser, the valid IP 2.X.Y.Z doesn't work. Instead, the internal IP 172.20.54.10 works. In other words, the apache test page is only shown from the local network.

Best Answer

2.X.Y.Z

is NOT bind to eth1 interface, yet 172.20.54.10 is, either comment out Listen 2.X.Y.Z:80 line or replace 2.X.Y.Z with 172.20.54.10 and then try to start your httpd.


Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

that means there is another process that is already binded to port 80, and that's why httpd won't start.

If I comment that line, the service will be started. However, in the browser, the valid IP 2.X.Y.Z doesn't work. Instead, the internal IP 172.20.54.10 works. In other words, the apache test page is only shown from the local network.

2.X.Y.Z probably won't work, due to routing/firewall not due httpd