I'm trying to start nginx on my Mac OS X using the command sudo nginx
It fails with the following error
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
nginx: [emerg] still could not bind()
I try to stop the Apache service by using sudo apachectl stop
This throws me the following error
launchctl: Error unloading: org.apache.httpd
According to this answer it most likely means that Apache is already not running
Then I tried to figure what is running on the Port 80 using sudo lsof -i:80
This outputs to this
Google 441 jaskaran 68u IPv4 0xa3f4d891ed1a8373 0t0 TCP 192.168.1.45:50993->www.google:http (ESTABLISHED)
Google 441 jaskaran 143u IPv4 0xa3f4d891ed054b5b 0t0 TCP 192.168.1.45:51017->www.scorecardresearch.com:http (ESTABLISHED)
Google 441 jaskaran 150u IPv4 0xa3f4d891eb9a1b5b 0t0 TCP 192.168.1.45:51018->www.scorecardresearch.com:http (ESTABLISHED)
Google 441 jaskaran 152u IPv4 0xa3f4d891ed1a4373 0t0 TCP 192.168.1.45:51019->www.scorecardresearch.com:http (ESTABLISHED)
Google 441 jaskaran 156u IPv4 0xa3f4d891ed071b5b 0t0 TCP 192.168.1.45:51020->www.scorecardresearch.com:http (ESTABLISHED)
The output to this command keeps on changing with time.
How do I get nginx to work?