starting nginx on mac fails with 48: address already in use [duplicate]
Solution 1:
Before attempting to start nginx
, check if something is already running on port '8080' as follows. I say port "8080", because that's the port number shown in the error message you posted:
$ sudo netstat -nlp | grep ':8080'
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 2355/nginx
tcp6 0 0 :::8080 :::* LISTEN 2355/nginx
In my case, that's showing a process named "nginx" with the Process ID of 2355 running on port 8080.
You try can issuing a kill -TERM 2355
to the related process ID to get to stop (assuming you don't want it running), and then confirm with netstat
, as shown above. Change "2355" to match your own process ID.
You may still get the error even if you've confirmed that nothing is running on that part before you try to start to nginx
. In that case, your Nginx may have conflicting entries regarding that port. Search your Nginx configuration for 8080
. If there are multiple mentions, review the docs for the related configuration to confirm you haven't used it too many times.