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

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.

Related

Address already in use for puma-dev

Problem
Whenever I try to run
bundle exec puma -C config/puma.rb --port 5000
I keep getting
bundler: failed to load command: puma (/Users/ogirginc/.asdf/installs/ruby/2.7.2/bin/puma)
Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 5000
Tried Things
I have tried anything I can think of or read. Here is the list:
1. Good old restart the mac.
Nope.
2. Find PID and kill.
Run lsof -wni tcp:5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc 20u IPv4 0x1deaf49fde14659 0t0 TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc 21u IPv6 0x1deaf49ec4c9741 0t0 TCP *:commplex-main (LISTEN)
Kill with sudo kill -9 6071.
When I kill it, it is restarted with a new PID.
> lsof -wni tcp:5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc 20u IPv4 0x1deaf49fde14659 0t0 TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc 21u IPv6 0x1deaf49ec4c9741 0t0 TCP *:commplex-main (LISTEN)
3. Use HTOP to find & kill
Filter with puma.
Found a match.
PID USER PRI NI VIRT RES S CPU% MEM% TIME+ Command
661 ogirginc 17 0 390G 6704 ? 0.0 0.0 0:00.00 /opt/homebrew/bin/puma-dev -launchd -dir ~/.puma-dev -d localhost -timeout 15m0s -no-serve-public-paths
Kill it with sudo kill -9 661.
Restarted with a new PID.
Additional Info
rails version is 5.2.6.
puma version is 4.3.8.
puma-dev version is 0.16.2.
Here are the logs for puma-dev:
2021/10/26 09:48:14 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/ogirginc/.puma-dev
* Domains: localhost
* DNS Server port: 9253
* HTTP Server port: inherited from launchd
* HTTPS Server port: inherited from launchd
! Puma dev running...
It feels like I am missing something obvious. Probably, due to lack of understanding some critical & lower parts of puma-dev. I would really appreciate, if this is solved with some simple explanation. Thanks in advance! :)
Why
Well, this is interesting. I did not think of searching for lsof's COMMAND column, before.
Turns out, ControlCe means "Control Center" and beginning with Monterey, macOS does listen ports 5000 & 7000 on default.
Solution
Go to System Preferences > Sharing
Uncheck AirPlay Receiver.
Now, you should be able to restart puma as usual.
Source: https://developer.apple.com/forums/thread/682332

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

Apache configured to listen on port 80 only but instead listening on port 8080 as well

I was not able to use port 8080 because it was apparently already used.
In order to see which program was using it, I typed the following command in my terminal (on MacOS):
sudo lsof -n -i :8080
Here's the result:
httpd is also listening on port 80, which I found out by using the following command:
sudo lsof -n -i :80 | grep LISTEN
Here's the result:
So I went to find out what this "httpd"-process was. Apparently it is basically the web server installed on my machine. The web server installed on my machine is Apache2.
Given this fact I concluded that Apache2 was apparently configured to listen on port 80 AND on port 8080.
BUT: Here's the crazy thing: I went to the folder /etc/apache2 and opened the file "httpd.conf". In the file Apache is configured to listen on port 80 only !!!
Why the hell is it also listening on port 8080 ?!
How can I make it listen on port 80 only ?

Running Reactive Native Project giving 404 not found

Running react-native sample project gives me a
404 Not Found. The Server could not locate the resource you request.
This can also happen if you've got an existing service running on port 8081, since that's the port that the packager runs on.
OPTION 1
Load from development server. Start the server from the repository root:
$ npm start
To run on device, change localhost to the IP address of your computer, and make sure your computer and iOS device are on the same Wi-Fi network.
just like this:
jsCodeLocation = [NSURL URLWithString:#"http://192.168.8.190:8081/Examples/2048/Game2048.includeRequire.runModule.bundle"];
To expand on Colin Ramsay's answer, you can check if a service is running on port 8081 by running the following command on OSX:
lsof -i :8081
If anything is running, something like his will show:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 918 Robert 6u IPv4 0x5c8c06c2a2e769cf 0t0 TCP *:sunproxyadmin (LISTEN)
nginx 1010 Robert 6u IPv4 0x5c8c06c2a2e769cf 0t0 TCP *:sunproxyadmin (LISTEN)
You can then use the PID to kill that service:
kill -9 918

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

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