How To Install Nginx Web Server: An Apache Alternative

Nginx (engine x) is a HTTP server, reverse proxy and mail proxy server written by Igor Sysoev.
It is a lightweight web server, licensed under a BSD-like license.

For features and benefits Check:
http://wiki.nginx.org/Main

For Pros and Cons of Using Nginx:
http://hostingfu.com/article/nginx-vs-lighttpd-for-a-small-vps

Installing Nginx.

To update the FreeBSD tree:

Code:
# portsnap fetch update

For additional info on keeping the ports tree up to date:
http://lantech.geekvenue.net/chucktips/jason/chuck/1000607537/index_html

To install the Nginx Web Server:

Code:
# cd /usr/ports/www/nginx
# make install clean

Make sure you install the Modules that are needed and the ones you require.
  • Core Modules
    • These modules are required.
  • Standard HTTP Modules
    • These modules are automatically compiled in unless explicitly disabled with configure.
  • Optional HTTP Modules
    • The following modules must be enabled at compile-time with the specified option to configure.
    • HTTP Addition
      • Append text to pages.
    • Embedded Perl
      • Use Perl in Nginx config files.
    • FLV
      • Flash streaming Video
    • Gzip Precompression
      • Checks if a (file).gz exists.
    • Random Index
      • Randomize directory indexes.
    • Real IP
      • For using Nginx as backend.
    • SSL
      • HTTPS/SSL support.
    • Stub Status
      • View server statistics.
    • Substitution
      • Replace text in pages.
    • WebDAV
      • WebDAV pass-through support.
    • Google Perftools
      • Google Performance Tools support.
    • XSLT
      • Post-process pages with XSLT.
    • Secure Link
      • Protect pages with a secret key.
    • Image Filter
      • Transform images with libgd.
  • Mail Modules
    • Mail Core
      • Nginx is able to handle and proxy the IMAP, POP3, SMTP protocols.
    • Mail Auth
      • Use Nginx to authenticate mail services.
    • Mail Proxy
      • Distributes mail to different hosts or ports.
    • Mial SSL
      • This module ensures SSL/TLS support for POP3/IMAP/SMTP.
  • Third Party Modules


Turning on Nginx Web Server:

Code:
echo 'nginx_enable="YES"' >> /etc/rc.conf

To start Nginx:

Code:
# /usr/local/etc/rc.d/nginx start

Additional important information:

Nginx default configuration file:

Code:
/usr/local/etc/nginx/nginx.conf

Nginx default http / https port:

80 / 443

Nginx default error log file:

Code:
/var/log/nginx-error.log

nginx default access log file:

Code:
/var/log/nginx-access.log

nginx default document root:

Code:
/usr/local/www/nginx/
 
Back
Top