(48)Address already in use: make_sock: could not bind to address [::]:80 on OS x Mavericks - apache

I just updated my OSX yesterday with Mavericks and now I am getting error while using apache and Jetty.
It used to map my example.com domain directly to the localhost.
Now It seems broke on do to run my application server I have to explicitly specifying port to hit my server.(ex. example.com:8080)
While I run below command.
sudo apachectl -e debug
I will get the
[debug] mod_so.c(246): loaded module jk_module
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
I ran many diff command to kill all httpd process as well find port which is listening on this port.
ex. sudo lsof -i :80
httpd 946 root 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
httpd 947 _www 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
httpd 949 _www 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
httpd 954 _www 5u IPv6 0xe0c8ad50898bcf0f 0t0 TCP *:http (LISTEN)
Google 1633 jignesh.sheth 59u IPv4 0xe0c8ad508597efaf 0t0 TCP example.com:53742->stackoverflow.com:http (ESTABLISHED)
Google 1633 jignesh.sheth 189u IPv4 0xe0c8ad5082027faf 0t0 TCP example.com:53725->stackoverflow.com:http (ESTABLISHED)
Any idea what am I doing wrong?

I also had the same, I removed 'Listern 80' from my config file to solve this issue.

I had the same error. The error log file for Apache server at /var/log/apache*/ mentioned "Address already in use: make_sock: could not bind to address 0.0.0.0:443".
Resolved it using "sudo lsof -i :" command to find processes running on port.
Kill all the processes and re-run sudo apachectl start.
The apache server should start running.
This may help: https://superuser.com/questions/479146/macports-apache2-could-not-bind-to-address/479147#479147?newreg=95099c6a74724da49640329d4ee400f2

I had the same problem.
What I did was changing the permission on "username.conf" from users directory to 644 like in this tutorial
http://www.coolestguidesontheplanet.com/downtown/get-apache-mysql-php-and-phpmyadmin-working-osx-109-mavericks

Related

Unable To Use Localhost Port 80 ; Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)

I am using a Mac Book Pro
I need to use my localhost Port :80 but i keep getting this ERROR message:
Error response from daemon: driver failed programming external
connectivity on endpoint nostalgic_ride : Error starting userland
proxy:
Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE).
this issue arose because i tried to use docker to do this:
docker run -it -p 80:80 -p 443:443 nginx
I did a search to see what is listening on all my ports:
sudo lsof -nP | grep LISTEN
UserEvent 41 root 113u IPv6 0xa09c168d9d24ed2f 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49153 (LISTEN)
UserEvent 41 root 114u IPv6 0xa09c168d9d24e1af 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49154 (LISTEN)
UserEvent 41 root 115u IPv6 0xa09c168d9d24dbef 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49155 (LISTEN)
UserEvent 41 root 116u IPv6 0xa09c168d9d24f2ef 0t0 TCP [fe80:8::aede:48ff:fe00:1122]:49156 (LISTEN)
php-fpm 48 root 8u IPv4 0xa09c168d9d7b322f 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 221 _www 9u IPv4 0xa09c168d9d7b322f 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 222 _www 9u IPv4 0xa09c168d9d7b322f 0t0 TCP 127.0.0.1:9000 (LISTEN)
EEventMan 351 tom 4u IPv4 0xa09c168da7672eaf 0t0 TCP *:2968 (LISTEN)
java 648 tom 69u IPv6 0xa09c168d9d24c4ef 0t0 TCP [fe80:1::1]:49185 (LISTEN)
LogiMgrDa 715 tom 4u IPv4 0xa09c168da914f52f 0t0 TCP *:59866 (LISTEN)
httpd 860 root 4u IPv6 0xa09c168da64892ef 0t0 TCP *:80 (LISTEN)
httpd 864 _www 4u IPv6 0xa09c168da64892ef 0t0 TCP *:80 (LISTEN)
httpd 955 _www 4u IPv6 0xa09c168da64892ef 0t0 TCP *:80 (LISTEN)
Questions:
It appears that there are 3 instances of httpd listening on Port 80. If so, does anyone know what these httpd are for and whether it's safe to remove them.
If so, how do I kill/remove them.
ANSWER TO SIMILAR QUESTIONS ON THIS ISSUE:
these answers do not help me beucase they all recommend simply changing the port. however i need port 80 for localhost development

Apache/Nginx configuration issue after uninstalling laravel/valet and homestead on macOS Sierra

After uninstalling laravel/valet and Homestead on macOS Sierra, I switched back to Apache (rather than NGINX), tried to restart it using sudo apachectl -k restart, and it outputs this error:
httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Additional Info - using Homebrew 1.3.1 with OS Sierra 10.12.6. Also used a similar local environment to the one found here:
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
Disclaimer: I almost never use NGINX but I'm assuming it, or something else involved in the laravel/valet setup is preventing Apache from binding to the right port.
How do I fix this error and reconfigure Apache to work with Homebrew again, instead of NGINX?
No output from lsof -i | grep LISTEN | grep ":80" but the output of sudo lsof -i :80 below:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 12146 root 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 12148 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37113 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37114 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 37115 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
httpd 38654 _www 4u IPv6 0x3f591ee6220c2a09 0t0 TCP *:http (LISTEN)
First check if nginx is running
ps aux | grep nginx
If it is running then check if it is running using brew
brew services list
If that shows nginx started then you use below command to stop it
brew services stop nginx
If it is not listed as started or not listed as a service then try to manually kill nginx
pkill nginx
Now to try to restart apache
sudo apachectl restart

port 80 is free but apache can not connect

I am trying to install Apache 2.4, I have downloaded the 2.4 zip and unzipped it, no I want to install it I ran the command.
C:\Apache24\bin>httpd
and I get the error code.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::f5ef:aeb7:3922:e603. Set the 'ServerName' directive globally to suppress this message
(OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : AH00072: make_sock: could not bind to address [::]:80
(OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : AH00072: make_sock: could not bind to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
I then ran the command
C:\WINDOWS\system32>netstat -o -n -a | findstr :80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
TCP 192.168.1.100:50103 104.82.216.43:80 TIME_WAIT 0
TCP 192.168.1.100:50113 185.31.18.134:80 TIME_WAIT 0
TCP 192.168.1.100:50114 185.31.18.134:80 TIME_WAIT 0
TCP 192.168.1.100:50119 72.21.202.25:80 TIME_WAIT 0
TCP 192.168.1.100:50127 104.156.81.134:80 TIME_WAIT 0
TCP 192.168.1.100:50131 185.31.19.130:80 ESTABLISHED 9564
TCP 192.168.1.100:50171 54.225.116.195:80 TIME_WAIT 0
TCP 192.168.1.100:50176 54.246.122.38:80 ESTABLISHED 9564
TCP 192.168.1.100:50190 23.23.141.250:80 TIME_WAIT 0
TCP 192.168.1.100:50191 155.133.248.14:80 SYN_SENT 7212
TCP [::]:80 [::]:0 LISTENING 4
and From this I think port 80 is free but am still not able to run Apache can any one help?
The port is not free its blocked, run
net stop was /y
to free the port

Can't restart apache (98)Address already in use, even after I kill process

I'm unable to (re)start apache because port 80 is already in use:
[root#out-dev log]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using <ip> for ServerName
(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]
So I tried identifying the process which was using port 80:
[root#out-dev log]# netstat -npl | grep ':80'
tcp 0 0 :::80 :::* LISTEN 3840/httpd
It's httpd! That's odd to me because the service httpd is apparently not running:
[root#out-dev log]# service httpd status
httpd is stopped
Anyway, I tried killing the process, but as soon as I do, a new process appears, taking control of port 80. And all the while, service httpd status indicates that httpd is not running.
[root#out-dev log]# kill -9 3840
[root#out-dev log]# netstat -npl | grep ':80'
tcp 0 0 :::80 :::* LISTEN 3842/httpd

'ubd' Process interfering with MAMP at port 80 [duplicate]

This question already has answers here:
How do I find out how macPorts stole my port:80?
(6 answers)
Closed 3 years ago.
A few days ago my Apache server stopped 'starting'. Does anyone know about this problem.
I believe it is happening now because I, stupidly, moved a file called index.php into the htdocs/ folder.
I run lsof -i | grep LISTEN to get:
mysqld 297 waltercarvalho 10u IPv4 0xc942753e30142a85 0t0 TCP *:mysql (LISTEN)
ubd 611 waltercarvalho 18u IPv4 0xc942753e310c9f35 0t0 TCP *:49228 (LISTEN)
ubd 611 waltercarvalho 19u IPv6 0xc942753e2d7a5635 0t0 TCP *:49228 (LISTEN)
Dropbox 720 waltercarvalho 18u IPv4 0xc942753e310c90c5 0t0 TCP *:17500 (LISTEN)
Dropbox 720 waltercarvalho 25u IPv4 0xc942753e31c584dd 0t0 TCP localhost:26164 (LISTEN)
When I try to start the Apache server on port 80, in order to access localhost (the clean way), I get:
I run sudo /Applications/MAMP/bin/startApache.sh to get:
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)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
Which means port 80 is being used. You can find my httpd.conf file at:
http://pastebin.com/dta3hND8
I have been trying to fix this for a few hours now, extremely frustrating. I have tried everything.
Thank you.
i've been struggling with this issue.. fairly certain it's dropbox that's interfering. i found a solution that works like a charm, albeit not a perm fix. i run the sequence fairly often. it's an annoyance, but at least these steps are clear, simple, and predictable! ..AND i get my 80/3306 back.
fix courtesy of Abhinav Sood.
Launch MAMP. Open Terminal by typing terminal into Spotlight (Command + Space).
Open MAMP Preferences (Command + , ) and click on Reset MAMP Ports
(Port 8888 and Port 8889 for Apache and MySQL respectively).
Click on OK.
Switch to the terminal. Type sudo apachectl stop to shutdown the system Apache.
Restart MAMP.
Open MAMP Preferences once again and click on Set to Default Apache and MySQL ports. This will set the Apache and MySQL ports to 80 and 3306 respectively.
Switch to the terminal. Type sudo apachectl restart to restart Apache.
Switch back to MAMP and click on Open Start Page (or go to http://localhost/MAMP/?language=English in your browser)
And you’re done.