I'm working on setting up a VPS with a Rails 3.1 application using nginx+passenger, and capistrano to boot strap it. At first, I installed nginx using a binary, forgetting that passenger installs it as well. When passenger asked me, I created a directory ~/opt/nginx for it to install into. Now, when I run the following:

sudo /etc/init.d/nginx stop
lsof -i:80

The server seems to stop, and nothing reports back at port 80. However, I then try to run

sudo ~/opt/nginx/sbin/nginx

And it says:

nginx: [emerg] bind() to failed (98: Address already in use)

Any ideas what's going on? Note that I installed nginx this way because I am using a user rvm install, and therefore using sudo passenger-install-nginx-module would specify the wrong version of ruby.


Did you run lsof with sudo?

Does this return anything listening on port 80?

netstat -an | grep LISTEN*

When you connect to port 80 do you get any message?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.