Nginx is a very popular web server just like apache. But it’s popular for it’s scalability. When it comes to handling requests, Nginx is a beast. It is simple, fast and friendly. Today we shall see how easily we can install Nginx on our Linux server.
Requirements
Nginx has the following requirements:
# Gzip module requires zlib library
# Rewrite module requires pcre library
# SSL support requires openssl library
Download NGinx from http://nginx.org/en/download.html
Extract the source and then run the following commands:
cd <directory> ./configure make sudo make install
To install on Ubuntu, use this command to get the PCRE packages:
sudo apt-get install libpcre3-dev
Running NGinx
Start the server by running /usr/local/nginx/sbin/nginx as root. After editing the configuration file at /usr/local/nginx/conf/nginx.conf to your liking, you can reload the configuration with:
kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
The location of nginx.pid might be different on your machine. For Ubuntu, it is located at:
/var/run/nginx.pid
Starting and Stopping
To start:
sudo /usr/bin/nginx
To Stop:
sudo /usr/bin/nginx -s stop
Or alternatively:
sudo kill -QUIT $( cat /usr/local/nginx/logs/nginx.pid )


