Last week I was able to use MAMP Pro on MacOS Big Sur 11.6 (Mackbook Pro M1) to run the nginx web server for multiple virtual hosts. Today, after using certbot locally in renewing my local LetsEncrypt SSL certificate that supports local dev https development, I cannot start nginx on any of the virtual hosts.
I get a warning in MAMP Pro that says "You configured nginx to use ports 80 and 443, but at least one of these seems to be in use." So I checked that MAMP is still configured to use port 80 for nginx. Then I used Activity Monitor to try to kill all httpd processes using port 80. Two of them, owned by root and _www, refused to die. So I used kill -9 with their respective PIDs. That killed them for a moment but they came back. After that, I tried to restart nginx again on port 80. It fails to start with message "Nginx couldn't be started. Please check the log file for more information."
The log file from that shows
2021/12/28 16:04:22 [emerg] 93920#0: bind() to 0.0.0.0:80 failed (48: Address already in use)
2021/12/28 16:04:22 [emerg] 93920#0: bind() to 0.0.0.0:80 failed (48: Address already in use)
2021/12/28 16:04:22 [emerg] 93920#0: bind() to 0.0.0.0:80 failed (48: Address already in use)
2021/12/28 16:04:22 [emerg] 93920#0: bind() to 0.0.0.0:80 failed (48: Address already in use)
2021/12/28 16:04:22 [emerg] 93920#0: bind() to 0.0.0.0:80 failed (48: Address already in use)
2021/12/28 16:04:22 [emerg] 93920#0: still could not bind()
How do I fully kill the root and _www user processes? More importantly, why is this happening? Was it something to do with the renewed LetsEncrypt SSL?
Support told me that this is a problem with MAMP Pro 5 on MacOS and that MAMP Pro 5 is no longer supported. Upgrading to MAMP 6+ solves the problem.
Related
Following the answer posted on SOF to change the Nginx default port on Plesk from 80 to 8080 while running Varnish on Port 80
I've worked on both options then stopped nginx to start varnish on port 80 however nginx refuses to run keep asking to run on port 80
-- Unit nginx.service has begun starting up.
Dec 14 22:58:17 server.example.com nginx[53793]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Dec 14 22:58:17 server.example.com nginx[53793]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Dec 14 22:58:17 server.example.com nginx[53796]: nginx: [emerg] bind() to 127.0.0.1:80 failed (98: Address already in use)
Dec 14 22:58:18 server.example.com nginx[53796]: nginx: [emerg] bind() to 127.0.0.1:80 failed (98: Address already in use)
Dec 14 22:58:18 server.example.com nginx[53796]: nginx: [emerg] bind() to 127.0.0.1:80 failed (98: Address already in use)
Please note that Apache is running on port 7080 also.
Is there a better guaranteed solution?
I first opened a Linode.com droplet.
Then installed Nginx, and left the default configuration.
I pointed my domain to the droplet's IP address.
The command "systemctl status nginx" - shows an error, this one seems relevant:
"Jun 18 14:40:13 localhost nginx[25837]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)"
I searched and racked my brains out until I tried this:
change config file so that Nginx/website listens to port 8080
Working fine, I then changed settings back to port 80 (stopped working)
The process was not halted, so step 2 allowed me to run the command "Nginx -s reload" (the reload signal needs the process running, and I couldn't restart Nginx with systemctl due to the original error)
While the website was not loading, I exited the SSH connection (which I checked, was using port 22, not 80)
My website then started working!
Re-entered the droplet with SSH, and found Nginx listening on port 80 just fine.
I want to understand why this worked, as it makes no sense that port 80 should be unavailable to Nginx just because I have an SSH connection.
I don't think it's unique to Linode's configuration as I have a Digital Ocean droplet too, and this was failing to listen on port 80 as well, although I never tried the fix I discovered on Linode.
I'm trying to configure my reverse proxy through nginx using this tutorial, but when I go to restart the nginx server, it throws the following error message:
nginx[12681]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
I checked out the port using netstat, and I have the following result
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN off (0.00/0/0)
What does this mean? When I go to my domain name, it redirects to the Centos page instead of an nginx page I should be getting. How can I configure the file to get it to redirect to nginx?
Edit:
Added httpd status
httpd.service disabled
mysql.service enabled
my_api.service enabled
nginx.service disabled
I get the above errors when I try to start nginx using systemctl
Running netstat -luntp as root showed that nginx had spawned a master process and a worker. Killing those processes solved the issue
I am using the nginx web server bundled with gitlab and I have SSL setup and I am using the non-default port i.e. I have the URL setup as
external_url 'https://www.myserver.com:2443'
However, when I connect with this address, I get a connection was reset error. Running, gitlab-cal tail shows
bind() to 0.0.0.0:80 failed (98: Address already in use)
I am not sure why it still is looking at port 80. Is there some other setting that I must set here.
Hello having a little issue with setting up linode via Railscast instructions of Ep. #335
My Configuration for this server is: Ubuntu 10.04 LTS Disk Image 32bit
I can get this far:
Running both of these work as expected.
apt-get -y update
apt-get -y install curl git-core python-software-properties
When I get to the nginx steps:
add-apt-repository ppa:nginx/stable
apt-get -y update
apt-get -y install nginx
Up to this point all seems to be working properly.
It is here:service nginx start
that I get the following in response:
* Starting nginx nginx
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
I have tried stopping, restarting and reloading nginx but I cannot get anything to change.
Any suggestions would be greatly appreciated. Thanks in advance.
It seems like you have something else running or blocking that port.
try running: sudo netstat -pan | grep ":80"
which should give you a hint on what is running on there. Maybe its a uwsgi/apache2/tomcat etc. Could be a lot running there.
EDIT:
i now know whats the problem as i had it myself now on a debian server.
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
You should comment the first or the second line (depends on if you want to listen of ipv6 or ipv4.
That was the problem i had.
I don't know if this is the proper solution, but it worked for me after I commented the line:
listen 80;
in /etc/nginx/sites-enabled/default