Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx restart command failing after installing passenger

I just installed passenger for nginx on my Ubuntu (8.04) box. Now "sudo /etc/init.d/nginx restart" fails with the following errors:

Restarting nginx: [emerg]: bind() to 0.0.0.0:3000 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:3000 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:3000 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:3000 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:3000 failed (98: Address already in use)
[emerg]: still could not bind()
nginx.

I updated the ..init.d/nginx config to point to /opt/nginx after installing passenger, so that should all be fine.

If I kill the process with "sudo killall nginx" and try to start nginx, it works fine, but restart doesn't work.

like image 432
Phil Jeffs Avatar asked Jan 30 '11 15:01

Phil Jeffs


People also ask

Why is reloading nginx better than stopping and restarting?

Reloading keeps the server running while re-reading any configuration file updates. Reloading is safer than restarting because if a syntax error is noticed in a config file, it will not proceed with the reload and your server remains running.

Do I need to restart Nginx?

Restart Nginx only when making significant configuration updates, such as changing ports or interfaces. This command will force shut down all worker processes.

How do I reload my Nginx configuration file?

To reload your configuration, you can stop or restart NGINX, or send signals to the master process. A signal can be sent by running the nginx command (invoking the NGINX executable) with the -s argument.

How do I start Nginx without Systemctl?

Restart Nginx Or if you are using a Linux distribution without systemd then use the following command: $ sudo service restart nginx.


2 Answers

In my case it was that apache was already installed and it was using the port; so i just did:

killall -9 apache2

Maybe in your case is another software, you can use this command to check what ports are listening petitions

netstat -a | egrep 'Proto|LISTEN'
like image 30
Ivan Castellanos Avatar answered Oct 23 '22 14:10

Ivan Castellanos


Just ignore

nginx: [warn] conflicting server name "69.162.95.11" on 69.162.95.11:80, ignored

It's not error just warning about 69.162.95.11 is not shared IP About

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

just restart Nginx will solve this issue if not then check none ssl port under tweak settings. The none ssl port should be 8081 after install. maestro 02-12-2011, 01:42 AM turn off port 80 from apache or ltespeed and turn on nginxcp as port 80

like image 150
hamid Avatar answered Oct 23 '22 14:10

hamid