Nginx on Ubuntu

The following are some of the features of Nginx:

* It serves static and index files
* Reverse proxy with caching
* Supports SSL
* Simple load balancing with fault tolerance
* Both name-based and ip-based virtual server can be configured
* HTTP basic authentication
* Supports rewrite module
* Supports gzip, XSLT, SSI and image resizing filters
* All the main mail proxy server features are supported
* and lot more..

During ./configure, you might get the “./configure: error: the HTTP rewrite module requires the PCRE library.” error message about missing PCRE library that is required by nginx http rewrite module.

To solve the problem, either install “pcre” and “pcre-devel” packages on your Linux, or disable the rewrite module by doing “./configure –without-http_rewrite_module”
Prerequsite – #sudo apt-get install libpcre3 libpcre3-dev

Configure Repo:
Follow Instructions on for reference

#apt-get update
#apt-get install nginx

For Source Installation:
#cd /usr/local
Download – http://wiki.nginx.org/Install
#tar xvzf nginx-1.2.3.tar.gz

Building Nginx from Source : go to the unzipped Nginx dir –
./configure –with-http_ssl_module
Nginx will be installed under /usr/local/nginx as shown by the ./configure output.
Compile time options
Example: –with-http_ssl_module

#make
#sudo make install

Change the Default Nginx Listen Port
Nginx is configured to listen by default on port 80. If you are installing this on a machine for testing purpose, that already has an apache server running, you should change the nginx listen port.
Similar to apache’s httpd.conf file, nginx has nginx.conf file located under /usr/local/nginx/conf.
In the server section of nginx.conf, change the port 80 to 8081
#vim  /usr/local/nginx-1.2.3/conf/nginx.conf
change 80 to 80123

Start Nginx Server
#sudo /etc/init.d/nginx start

To stop the nginx server, do the following.
#cd /usr/local/nginx/sbin
./nginx -s stop

or

#sudo /etc/init.d/nginx stop

To view the current version of nginx, do the following:
# ./nginx -v
nginx: nginx version: nginx/1.0.5

To debug issues, view the error.log and access.log files located under /usr/local/nginx/logs
# ls /usr/local/nginx/logs/
access.log
error.log
nginx.pid

More on Nginx —
DocumentRoot equivalent of Apache in Nginx is /usr/local/nginx/html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s