Nginx Module Extension

Nginx Module Extension
eBook: $20.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $55.98    Print cover: $34.99
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Install Nginx from its source on multiple platforms
  • Become acquainted with core Nginx modules and their configuration options
  • Explore optional and third party module extensions along with configuration directives

Book Details

Language : English
Paperback : 128 pages [ 235mm x 191mm ]
Release Date : December 2013
ISBN : 1782163042
ISBN 13 : 9781782163046
Author(s) : Usama Dar
Topics and Technologies : All Books, Networking and Servers, Virtualization and Cloud, Open Source

Table of Contents

Chapter 1: Installing Nginx Core and Modules from Source
Chapter 2: Configuring Core Modules
Chapter 3: Installing and Configuring HTTP Modules
Chapter 4: Installing Third-party Modules
Chapter 5: Creating Your Own Module
  • Chapter 1: Installing Nginx Core and Modules from Source
    • Installing binary distribution
      • Red Hat, Fedora, and CentOS
      • Official Debian/Ubuntu packages
      • FreeBSD
      • OpenBSD
      • Official Win32 binaries
    • Installing source distribution
      • Nginx library dependencies
      • Configuring options
        • Files and permissions
        • The Event loop
        • Optional modules
        • Compilation controls
        • Example
        • The Custom module
        • Debugging
      • Installing on other platforms
      • Verifying your Nginx installation
    • Summary
  • Chapter 2: Configuring Core Modules
    • Understanding the Main module
      • Explaining directives
        • daemon
        • master_process
        • timer_resolution
        • pid
        • lock_file
        • worker_processes
        • debug_points
        • user
        • worker_priority
        • worker_cpu_affinity
        • worker_rlimit_nofile
        • worker_rlimit_core
        • worker_rlimit_sigpending
        • working_directory
        • env
    • Understanding the Events module
      • Explaining directives
        • accept_mutex
        • accept_mutex_delay
        • debug_connection
        • devpoll_changes and devpoll_events
        • kqueue_changes and kqueue_events
        • epoll_events
        • multi_accept
        • rtsig_signo
        • rtsig_overflow_events, rtsig_overflow_test, and rtsig_overflow_threshold
        • use
        • worker_connections
    • Summary
  • Chapter 3: Installing and Configuring HTTP Modules
    • Standard HTTP modules
      • The core module (HttpCoreModule)
      • Explaining directives
        • server
        • server_name
      • Controlling access (HttpAccessModule)
      • Authenticating users (HttpBasicAuthModule)
        • Explaining directives
      • Load balancing (HttpUpstreamModule)
        • Explaining directives
      • Acting as a proxy (HttpProxyModule)
        • Explaining directives
      • Compressing content (HttpGzipModule)
        • Explaining directives
      • Controlling logging (HttpLogModule)
        • Explaining directives
      • Setting response headers (HttpHeadersModule)
        • Explaining directives
      • Rewriting requests (HttpRewriteModule)
        • Explaining directives
      • Interacting with FastCGI (HttpFastcgiModule)
      • Simple caching (HttpMemcachedModule)
        • Explaining directives
      • Limiting requests (HttpLimitReqModule)
        • Explaining directives
      • Limiting connections (HttpLimitConnModule)
        • Explaining directives
    • Summary
  • Chapter 4: Installing Third-party Modules
    • Compiling third-party modules
      • Communicating with PostgreSQL (ngx_postgres)
        • Explaining directives
      • Communicating with MySQL and drizzle (drizzle-nginx)
        • Explaining directives
      • Digest Authentication (ngx_http_auth_digest)
        • Explaining directives
      • Speeding up web pages (ngx_pagespeed)
        • Configuring handlers
      • Lua scripting (ngx_lua)
        • Explaining directives
      • Reverse IP lookup using the GeoIP module (ngx_http_geoip_module)
        • Explaining directives
      • Doing healthchecks
        • ngx_http_healthcheck_module
        • Explaining directives
        • Load balancing
    • Summary
  • Chapter 5: Creating Your Own Module
    • Nginx module delegation
      • Handlers
      • Load balancers
      • Filters
        • Order of execution
    • The extended "Hello world" module
      • Writing and compiling a module
        • The "Hello world" source code
      • Components of the Nginx module
        • Module configuration structures
        • Module directives
        • The module context
        • The module definition
        • The handler function
    • Nginx Development Toolkit (NDK)
    • Summary

Usama Dar

Usama Dar has over 13 years' experience working with software systems. During this period, he has not only worked with large companies such as Nortel Networks, Ericsson, and Huawei, but has also been involved with successful startups such as EnterpriseDB. He has worked with systems with mission-critical requirements of scalability and high availability. He writes actively on this website: These days, Usama works at the Huawei Research Centre in Munich, where he spends most of his time researching highly scalable, high-performing infrastructure software (such as operating systems), databases, and web and application servers.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Nginx Module Extension +    Drupal Multimedia =
50% Off
the second eBook
Price for both: $27.30

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Install Nginx from its source on various platforms with instructions on various platform specific options
  • Configure error logging, processes, and permissions
  • Learn how Nginx handles events and how to configure epoll, kqueue, select, and poll
  • Utilize standard and optional HTTP modules, and combine many of these modules to achieve various system admin tasks
  • Acquaint yourself with available third party Nginx modules
  • Employ LUA as a programming language to write Nginx configuration files
  • Familiarize yourself with modules like PostgreSQL and Memcached and learn how to optimally configure them
  • Understand the internals on Nginx and write your own modules
  • Gain knowledge about core Nginx concepts like module chaining and also different types of modules like handlers, filters, and load balancers

In Detail

Companies can solve significant scaling issues thanks to switching their web platforms to Nginx. A popular web server for building web infrastructure, Nginx transparently and effectively enables the growth of the largest sites on the Internet today, on top of being free and open source.

This book is a practical reference providing you with everything you need to know about Nginx module extensions. You will learn how to write powerful and flexible configuration files and your own modules, as well as gaining knowledge about Nginx’s modular architecture, available modules, and their intricate details.

Nginx Module Extension starts by teaching you to compile the Nginx source on multiple platforms. Then you will learn the synopsis, directives, and practical examples of the core, optional, and third party Nginx modules before familiarizing yourself with Nginx internals, enabling you to write custom modules.

You will learn about the flexibility of the Nginx configuration and how to enable and disable various options while building from the source. You will learn to customize the Main and Events module to fine-tune the web server performance, and you will also learn about standard and optional HTTP modules like GeoIP, Gzip, Access Control, and using SSL, along with an exploration of PostgreSQL, MySQL, and Memcached modules. Finally you will learn internals like module chaining and will see sample code and a line-by-line walkthrough demonstrating how to write your own module.


This book is a step-by-step, example-oriented tutorial that will teach you to implement Nginx modules, as well as how to extend Nginx with core and third party modules.

Who this book is for

Nginx Module Extension is intended for advanced users, system administrators, and developers of Nginx modules. You need to have prior experience with using Nginx as a web server and basic Nginx configuration changes. You also need basic understanding of GNU tools like configure and make, in order to be able to compile the source code. Proficiency in C programming and advanced operating system knowledge on Linux kernel, for example, would also come in handy.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software