Register now and start sharing your code snippets.
-->

Installing nginx on Debian

Shell Script (Bash) posted 8 months ago by christian

DRAFT …

Find latest version of nginx

http://sysoev.ru/en/ http://wiki.codemongers.com/NginxInstallOptions

Install a compiler otherwise: ./configure: error: C compiler gcc is not found

The command:

   1  sudo apt-get install build-essential

Install pre-requisites otherwise you’ll get:

Configuration summary + threads are not used + PCRE library is not found + OpenSSL library is not found + md5 library is not used + sha1 library is not used + zlib library is not found

The command:

   1  sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev

Much better:

Configuration summary + threads are not used + using system PCRE library + using system OpenSSL library + md5 library is not used + sha1 library is not used + using system zlib library

Compile and install nginx

   1  $ ./configure \
   2          --sbin-path=/usr/local/sbin \
   3          --conf-path=/etc/nginx/nginx.conf \
   4          --pid-path=/var/run/nginx.pid \
   5          --error-log-path=/var/log/nginx/error.log \
   6          --http-log-path=/var/log/nginx/access.log \
   7          --with-http_ssl_module \
   8          --http-client-body-temp-path=/tmp/nginx_client \
   9          --http-proxy-temp-path=/tmp/nginx_proxy \
  10          --http-fastcgi-temp-path=/tmp/nginx_fastcgi
  11  $ make
  12  $ sudo make install

Run the install script

   1  cd /usr/local/src
   2  
   3  wget http://sysoev.ru/nginx/nginx-0.5.35.tar.gz
   4  
   5  tar zxvf nginx-0.5.35
   6  
   7  cd nginx-0.5.35

Create an nginx user and group

   1  $ useradd -g www-data -d /var/www nginx

Create the web server directory

   1  mkdir /var/www
   2  chown root.www-data /var/www
   3  chmod ug=rwx,o= /var/www

Test configuration

   1  nginx -t
   2  2008/03/09 20:51:05 [info] 5034#0: the configuration file /etc/nginx/nginx.conf syntax is ok
   3  2008/03/09 20:51:05 [info] 5034#0: the configuration file /etc/nginx/nginx.conf was tested successfully

Start nginx

   1  nginx

Tagged nginx, install, debian