Nginx – 2 versions of nginx installed

nginxphusion-passengerubuntu-10.10

I had nginx 0.8.54 installed on my Ubuntu 10.10 dev machine with php fastcgi all set up and working.

I wanted to start doing some Rails dev so I tried to install Passenger into my existing nginx install. Now everything seems all mixed up. My /sites-available/default config does not seem to be working in that I can't browse the dev sites I had previously set up.

When I run nginx -v at the terminal it says 0.8.54 but when I browse to say http://localhost/xyz it returns a 404 and the 404 error page indicates 0.8.53.

Also, if I run service nginx restart I get the following:

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

It seems like I have two versions of nginx running. Is that possible? How can I fix this so I have 1 version with php fastcgi and Rails/Passenger running?

Best Answer

maybe you installed two versions of nginx:

# whereis nginx
nginx: /usr/sbin/nginx /etc/nginx /usr/local/sbin/nginx /usr/share/man/man1/nginx.1.gz
# nginx -V
nginx version: nginx/0.8.54
# /usr/sbin/nginx -V
nginx version: nginx/0.7.67

pathname expansion nginx to "/usr/local/sbin/nginx", because PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games(/usr/local/sbin before /usr/sbin).

Also try use find:

# find / -name nginx -executable -type f
/usr/sbin/nginx
/usr/local/sbin/nginx
/etc/init.d/nginx
Related Topic