how to compile/install and upgrade nginx

Ubuntu 8.04 LTS (Hardy Heron) comes with nginx 0.6.34. This nginx worked fine, until one day I tried to use "try_files". Nginx returned error : "Unknown directive: 'try_files'". Later I learnt only nginx version 0.6.36+, 0.7.27+ or 0.8.x support the 'try_files' command. So, I decided to upgrade my nginx to the newest stable version, and it turned out the process was so hard:

download nginx

wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz

extract it

tar -zxvf nginx-0.7.62.tar.gz

download and extract pcre library

wget http://sourceforge.net/projects/pcre/files/pcre/7.9/pcre-7.9.tar.gz/download
tar -xzf pcre-7.9.tar.gz

configure and compile nginx

cd nginx-0.7.62
./configure --sbin-path=/usr/sbin --with-http_ssl_module --with-pcre=../pcre-7.9 
make

I put nginx bin into /usr/sbin folder, where the old nginx file in.

stop nginx to install new version file:

/etc/init.d/nginx stop

install nginx

sudo make install
cd ..

after the installation , these messages is given:

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/sbin"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"

copy your nginx configuration file to new location:

cp /etc/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf

now, new nginx is installed, check version:

nginx -v

it shall give:

nginx version: nginx/0.7.62

restart the nginx:

/etc/init.d/nginx start

Your nginx have been upgrade to new version!

08 Apr17:46

wget

By xain

wget http://sourceforge.net/projects/pcre/files/pcre/7.9/pcre-7.9.tar.gz/download
tar -xzf pcre-7.9.tar.gz
are two commands.
The first one download pcre pack from the internet, the second one ( tar -xzf pcre-7.9.tar.gz) extract file from the zipped pack.

If the extracting command do not work, I think you should check if the pcre-7.9.tar.gz has been completely downloaded.

06 Apr17:50

it will not extract the pcre!

By juanel (not verified)

it will not extract the pcre! i tried this: wget http://sourceforge.net/projects/pcre/files/pcre/7.9/pcre-7.9.tar.gz/download
tar -xzf pcre-7.9.tar.gz

BUT it is stuck with this: tar -xzf pcre-7.9.tar.gz,

the command line just show tar -xzf pcre-7.9.tar.gz and will just do the same if you hit enter! what gives?

Post new comment

The content of this field is kept private and will not be shown publicly.