Installed nginx 0.8.54 with apt-get from ubuntu repo. Executing command "passenger-install-nginx-module" installed nginx 1.0.6 (I believe). After restart however, nginx -v still shows version 0.8.54. How to fire up the nginx 1.0.6?

Here is the error when starting nginx under /opt/nginx/sbin which is 1.0.6 (after stop the current nginx server):

    dtt@ubuntu:/etc$ sudo /opt/nginx/sbin/nginx nginx
: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx
: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx
: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx
: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx
: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx
: [emerg] still could not bind() 

Thanks.

link|improve this question
feedback

migrated from stackoverflow.com Nov 1 '11 at 14:29

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 0 down vote accepted

Executing command passenger-install-nginx-module installed nginx 1.0.6 (I believe)

If you pay attention to the installation process, you will see that, by default it install Nginx with --prefix=/opt/nginx, so you must use the absolute path:

$ /opt/nginx/sbin/nginx -v
nginx: nginx version: nginx/1.0.6

$ /opt/nginx/sbin/nginx -V 
nginx: nginx version: nginx/1.0.6 
nginx: built by gcc 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) 
nginx: TLS SNI support enabled 
nginx: configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-cc-opt=-Wno-error --add-module=/home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/ext/nginx

Why did you said it still shows 0.8.54?

How to start the nginx 1.0.6?

Stop the Nginx 0.8.54 first:

# /etc/init.d/nginx stop

or:

# /usr/sbin/nginx -s stop

and start Nginx 1.0.6 with:

# /opt/nginx/sbin/nginx

Don't forget to edit the init script to the new binary and configuration, something like this:

start() {
    configtest || return 1
    ebegin "Starting nginx"
    start-stop-daemon --start --pidfile /var/run/nginx.pid \
        --exec /opt/nginx/sbin/nginx -- -c /opt/nginx/conf/nginx.conf
    eend $? "Failed to start nginx"
}
link|improve this answer
Yes, it is exactly the same output when typing nginx -v. How to start the nginx 1.0.6? The output is still 0.8.54 when typing nginx -v and I assume nginx is running version of 0.8.54. – user938363 Nov 2 '11 at 1:05
the output of 'which nginx' is : /usr/sbin/nginx. This is the ver 0.8.54 – user938363 Nov 2 '11 at 1:24
Append a snippet of output when installing to make sure that it is installed successfully. Also show us /opt/nginx/sbin/nginx -V and $ tree -L 3 /opt/nginx/? – quanta Nov 2 '11 at 2:23
dtt@ubuntu:/usr/sbin$ /opt/nginx/sbin/nginx -V nginx: nginx version: nginx/1.0.6 nginx: built by gcc 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) nginx: TLS SNI support enabled nginx: configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-cc-opt=-Wno-error --add-module=/home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/ext/nginx – user938363 Nov 2 '11 at 2:31
dtt@ubuntu:/usr/sbin$ tree -L 3 /opt/nginx/? /opt/nginx/? [error opening dir] 0 directories, 0 files – user938363 Nov 2 '11 at 2:33
show 7 more comments
feedback

Your Answer

 
or
required, but never shown

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