0

I originally installed nginx like:

apt-get install python-software-properties
add-apt-repository ppa:nginx/stable
apt-get update && apt-get --yes upgrade
apt-get install nginx

and I wanted to add a new module to it, so I tried the following instructions from Recompile NGINX with "--with-http_stub_status_module" configure line "Download the source from nginx.org and unpack it. Use/path/to/your/nginx/binary -V to get your current configure line. Modify it as you see fit, and run the configure file from the nginx source with your new configure line. Then run make, make install and make upgrade and you're all updated."

I created a directory /srv/software/nginx-src/ than

wget http://nginx.org/download/nginx-1.1.5.tar.gz
tar -xzf nginx-1.1.5.tar.gz
./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/srv/software/nginx-modules/ngx_cache_purge-1.4
make
make install
make upgrade

everything worked, however, my nginx -v still shows:

nginx: nginx version: nginx/1.0.10
nginx: TLS SNI support enabled
nginx: configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.0.10/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.0.10/debian/modules/nginx-upstream-fair

It is not updating.... lastly, I tried to uninstall it completely apt-get remove --purge which I think worked, but I am not sure. I can not seem to get the right version to work and now I am worry my server is borked! fml. any help, would be great right now.

Update (1): after finding this guide http://articles.slicehost.com/2009/3/4/ubuntu-intrepid-installing-nginx-from-source and @limon help below I setup the following:

./configure --sbin-path=/usr/local/sbin/nginx --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/srv/software/nginx-modules/ngx_cache_purge-1.4

make
make install

i ran which version

root@www:/srv/software/nginx-src/nginx-1.1.5# which nginx
/usr/local/sbin/nginx

but when i try to start it, it will not work

root@www:/srv/software/nginx-src/nginx-1.1.5# sudo /usr/local/sbin/nginx
nginx: [emerg] mkdir() "/var/lib/nginx/body" failed (2: No such file or directory)

Update (2): after reading Limon's commend I needed to create a few directories in /var/lib: mkdir -p /var/lib/nginx/body mkdir -p /var/lib/nginx/proxy mkdir -p /var/lib/nginx/fastcgi mkdir -p /var/lib/nginx/uwsgi mkdir -p /var/lib/nginx/sc

I created these directories and ran sudo /usr/local/sbin/nginx my nginx was now correctly reporting the following:

nginx: nginx version: nginx/1.1.5
nginx: built by gcc 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) 
nginx: TLS SNI support enabled
nginx: configure arguments: --sbin-path=/usr/local/sbin/nginx --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/srv/software/nginx-modules/ngx_cache_purge-1.4 

since my configuration was using jugledisc I pulled my old init.d off of a backup and changed it to point to the correct location.

Chris Hough
  • 313
  • 2
  • 4
  • 21

1 Answers1

0

Since you didn't remove the deb package before compiling the new version from source, it is likely you had multiple versions of the nginx binary installed on the server - to check which one you are calling you can use the 'which' utility like this:

cricket:[~]: which mysql
/usr/bin/mysql

At this point I would use use:

apt-get --purge autoremove nginx

And then reinstall nginx from source.

jlimon
  • 41
  • 1
  • ok I ran these commands which completely uninstalled the software. I went into the /srv/software/nginx-src/ and re-ran, configure, make, and lastly make install. however, now there are other issues: no startup init.d, when i run which nginx it returns nothing...what's next? – Chris Hough Dec 03 '11 at 23:41
  • It seems you can grab an init script for Ubuntu here: http://wiki.nginx.org/Nginx-init-ubuntu – jlimon Dec 04 '11 at 00:03
  • Actually, to expand my previous comment - I didn't notice you said which returned nothing. If which is returning nothing that means that no nginx binary is found in your PATH variable. Can you paste in the output of 'make install'? – jlimon Dec 04 '11 at 00:05
  • I can not copy the entire output, its too big. any ideas? i can email them to you... – Chris Hough Dec 04 '11 at 00:18
  • Actually, your recent edit gave me the information I would have looked for. According to a comment here: http://vladgh.com/blog/install-nginx-and-php-php-fpm-mysql-and-apc?page=3 You may need to create a few directories in /var/lib: mkdir -p /var/lib/nginx/body mkdir -p /var/lib/nginx/proxy mkdir -p /var/lib/nginx/fastcgi mkdir -p /var/lib/nginx/uwsgi mkdir -p /var/lib/nginx/scgi – jlimon Dec 04 '11 at 00:26
  • that worked. is there anything I can use to test to make sure this install is not jacked up? – Chris Hough Dec 04 '11 at 00:59
  • With the server up, all that I would imagine that would need to be done is test each of the virtual hosts and tail the error log. I can't think of any obvious gotchas as my nginx experience is not nearly as vast as my Apache experience. – jlimon Dec 04 '11 at 01:13
  • thank you so much for your help, I really appreciate it. – Chris Hough Dec 04 '11 at 02:17