Nginx 1 Web Server Implementation Cookbook

Over 100 recipes to master using the Nginx HTTP server and reverse proxy
Preview in Mapt

Nginx 1 Web Server Implementation Cookbook

Dipankar Sarkar

1 customer reviews
Over 100 recipes to master using the Nginx HTTP server and reverse proxy
Mapt Subscription
FREE
$29.99/m after trial
eBook
$2.40
RRP $23.99
Save 89%
Print + eBook
$39.99
RRP $39.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$2.40
$39.99
$29.99p/m after trial
RRP $23.99
RRP $39.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Nginx 1 Web Server Implementation Cookbook Book Cover
Nginx 1 Web Server Implementation Cookbook
$ 23.99
$ 2.40
Oracle WebLogic Server 12c Advanced Administration Cookbook Book Cover
Oracle WebLogic Server 12c Advanced Administration Cookbook
$ 29.99
$ 21.00
Buy 2 for $19.90
Save $34.08
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781849514965
Paperback236 pages

Book Description

Nginx is an open source high-performance web server, which has gained quite some popularity recently. Due to its modular architecture and small footprint, it has been the default choice for a lot of smaller Web 2.0 companies for use as a load-balancing proxy server. It supports most of the existing back-end web protocols like FCGI, WSGI, and SCGI. This book is for you if you want to have in-depth knowledge of the Nginx server.

Nginx 1 Web Server Implementation Cookbook covers the whole range of techniques that would prove useful for you in setting up a very effective web application with the Nginx web server. It has recipes for lesser-known applications of Nginx like a mail proxy server, streaming of video files, image resizing on the fly, and much more.

The first chapter of the book covers the basics that would be useful for anyone who is starting with Nginx. Each recipe is designed to be independent of the others.

The book has recipes based on broad areas such as core, logging, rewrites, security, and others. We look at ways to optimize your Nginx setup, setting up your WordPress blog, blocking bots that post spam on your site, setting up monitoring using munin, and much more.

Nginx 1 Web Server Implementation Cookbook makes your entry into the Nginx world easy with step-by-step recipes for nearly all the tasks necessary to run your own web application.

Table of Contents

Chapter 1: The Core HTTP Module
Introduction
Installing new modules and compiling Nginx
Running Nginx in debug mode
Easy reloading of Nginx using the CLI
Splitting configuration files for better management
Setting up multiple virtual hosts
Setting up a default catch-all virtual host
Using wildcards in virtual hosts
Setting up the number of worker processes correctly
Increasing the size of uploaded files
Using dynamic SSI for simple sites
Adding content before and after a particular page
Enabling auto indexing of a directory
Serving any random web page from a directory
Serving cookies for identifying and logging users
Re-encoding the response to another encoding
Enabling Gzip compression on some content types
Setting up 404 and other error pages
Chapter 2: All About Rewrites: The Rewrite Module
Introduction
Setting up a simple redirect
Using variables in your rewrite
Using cookies for your rewrites
Using browser agents for your rewrites
Using rate limits as a condition for rewrites
Blocking requests based on HTTP referrers
Serving maintenance page when deploying
Setting up a WordPress site with static file serving
Setting up a Drupal site with static file serving
Setting up a Magento site with static file serving
Converting your Apache's .htaccess into Nginx rewrites
Using maps to make configurations cleaner
Chapter 3: Get It All Logged: The Logging Module
Introduction
Setting up error log path and levels
Logging it like Apache
Disabling logging of 404 in error logs
Using different logging profiles in the same setup
Enabling a log file cache
Utilizing separate error logs per virtual host
Setting up log rotation
Enabling remote logging with syslog-ng
Setting up your custom logs for easy parsing
Chapter 4: Slow Them Down: Access and Rate Limiting Module
Introduction
Limiting requests for any given session
Blocking and allowing access using IP
Setting up simple rate limiting for a download directory
Rate limiting search engine bots
Setting up GeoIP using the MaxMind country database
Using the GeoIP module to set up access and rate control
Chapter 5: Let's be Secure: Security Modules
Introduction
Setting up HTTP auth for access control
Generating a secure link for files
Setting up HTTPS for a simple site
Using non standard error codes for debugging SSL setup
Using wildcard certificates with multiple servers
Using Nginx SSL variables for rewrite rules
Chapter 6: Setting Up Applications: FCGI and WSGI Modules
Introduction
Setting up a PHP FCGI site
Setting up a Python site using uWSGI
Modifying FCGI timeouts
Utilizing FCGI cache to speed it up
Using multiple FCGI backends
Chapter 7: Nginx as a Reverse Proxy
Introduction
Using Nginx as a simple reverse proxy
Setting up a rails site using Nginx as a reverse proxy
Setting up correct reverse proxy timeouts
Setting up caching on the reverse proxy
Using multiple backends for the reverse proxy
Serving CGI files using thttpd and Nginx
Setting up load balancing with reverse proxy
Splitting requests based on various conditions using split-clients
Chapter 8: Improving Performance and SEO Using Nginx
Introduction
Setting up TCP options correctly for optimizing performance
Reducing the keep-alives to free up Nginx workers
Using Memcached as the cache backend
Configuring the right event model and file limits
Setting max-age expiry headers for client-side caching
Blocking scrapers, bots, and spiders to save bandwidth
Redirection of www to non-www domain for SEO
Removing all white space from response
Setting up server status for monitoring
Setting up Munin for 24x7 Nginx monitoring
Enabling GZIP pre-compression
Preventing hotlinking using Nginx
Using embedded Perl to minify JavaScript files
Using embedded Perl to minify CSS files
Using embedded Perl to serve sitemaps (SEO)
Setting up Boost module on Drupal with Nginx
Setting up streaming for Flash files
Utilizing the 1x1 GIF serving module to do offline processing
Chapter 9: Using Other Third-party Modules
Introduction
Setting up an IMAP/POP3 proxy server
Setting up authentication for mail services
Setting up SSL for mail authentication
Using Nginx as a WEBDAV reverse proxy
Dynamic image resizing using Nginx
Replacing and searching text in Nginx response
Assembling ZIP files on the fly
Using Nginx as a HTTP publish-subscribe server
Transforming XML responses using XSLT templates
Setting up Etags for static content
Easy logging of page load times
Streaming of MP4/H.264 files
Setting up SCGI sites
Setting up expiring links
Chapter 10: Some More Third-party Modules
Introduction
Configuring a fair load balancing
Setting up health checks for backend servers
Tracking and reporting file upload progress
Generating circles for round edges using Nginx
Running Python using Phusion Passenger
Generating graphs directly from RRDtool in Nginx
Using Google performance tools
Serving content directly from GridFS
Configuring Basic HTTP auth using PAM
Configuring Basic HTTP auth using Kerberos

What You Will Learn

  • Run and debug Nginx issues effectively
  • Set up WordPress and Drupal sites using FCGI
  • Set up Nginx log rotation on various UNIX systems
  • Stop bots and scrapers from slowing down and spamming your site
  • Learn to set up SSL certificates and secure your site
  • Learn how to use WSGI and set up a Python-based web application
  • Set up a fair load-balancing reverse proxy using Nginx
  • Use memcached as a caching backend for Nginx
  • Set up Flash streaming for your website without additional software
  • Convert Apache configurations into working Nginx configurations

Authors

Table of Contents

Chapter 1: The Core HTTP Module
Introduction
Installing new modules and compiling Nginx
Running Nginx in debug mode
Easy reloading of Nginx using the CLI
Splitting configuration files for better management
Setting up multiple virtual hosts
Setting up a default catch-all virtual host
Using wildcards in virtual hosts
Setting up the number of worker processes correctly
Increasing the size of uploaded files
Using dynamic SSI for simple sites
Adding content before and after a particular page
Enabling auto indexing of a directory
Serving any random web page from a directory
Serving cookies for identifying and logging users
Re-encoding the response to another encoding
Enabling Gzip compression on some content types
Setting up 404 and other error pages
Chapter 2: All About Rewrites: The Rewrite Module
Introduction
Setting up a simple redirect
Using variables in your rewrite
Using cookies for your rewrites
Using browser agents for your rewrites
Using rate limits as a condition for rewrites
Blocking requests based on HTTP referrers
Serving maintenance page when deploying
Setting up a WordPress site with static file serving
Setting up a Drupal site with static file serving
Setting up a Magento site with static file serving
Converting your Apache's .htaccess into Nginx rewrites
Using maps to make configurations cleaner
Chapter 3: Get It All Logged: The Logging Module
Introduction
Setting up error log path and levels
Logging it like Apache
Disabling logging of 404 in error logs
Using different logging profiles in the same setup
Enabling a log file cache
Utilizing separate error logs per virtual host
Setting up log rotation
Enabling remote logging with syslog-ng
Setting up your custom logs for easy parsing
Chapter 4: Slow Them Down: Access and Rate Limiting Module
Introduction
Limiting requests for any given session
Blocking and allowing access using IP
Setting up simple rate limiting for a download directory
Rate limiting search engine bots
Setting up GeoIP using the MaxMind country database
Using the GeoIP module to set up access and rate control
Chapter 5: Let's be Secure: Security Modules
Introduction
Setting up HTTP auth for access control
Generating a secure link for files
Setting up HTTPS for a simple site
Using non standard error codes for debugging SSL setup
Using wildcard certificates with multiple servers
Using Nginx SSL variables for rewrite rules
Chapter 6: Setting Up Applications: FCGI and WSGI Modules
Introduction
Setting up a PHP FCGI site
Setting up a Python site using uWSGI
Modifying FCGI timeouts
Utilizing FCGI cache to speed it up
Using multiple FCGI backends
Chapter 7: Nginx as a Reverse Proxy
Introduction
Using Nginx as a simple reverse proxy
Setting up a rails site using Nginx as a reverse proxy
Setting up correct reverse proxy timeouts
Setting up caching on the reverse proxy
Using multiple backends for the reverse proxy
Serving CGI files using thttpd and Nginx
Setting up load balancing with reverse proxy
Splitting requests based on various conditions using split-clients
Chapter 8: Improving Performance and SEO Using Nginx
Introduction
Setting up TCP options correctly for optimizing performance
Reducing the keep-alives to free up Nginx workers
Using Memcached as the cache backend
Configuring the right event model and file limits
Setting max-age expiry headers for client-side caching
Blocking scrapers, bots, and spiders to save bandwidth
Redirection of www to non-www domain for SEO
Removing all white space from response
Setting up server status for monitoring
Setting up Munin for 24x7 Nginx monitoring
Enabling GZIP pre-compression
Preventing hotlinking using Nginx
Using embedded Perl to minify JavaScript files
Using embedded Perl to minify CSS files
Using embedded Perl to serve sitemaps (SEO)
Setting up Boost module on Drupal with Nginx
Setting up streaming for Flash files
Utilizing the 1x1 GIF serving module to do offline processing
Chapter 9: Using Other Third-party Modules
Introduction
Setting up an IMAP/POP3 proxy server
Setting up authentication for mail services
Setting up SSL for mail authentication
Using Nginx as a WEBDAV reverse proxy
Dynamic image resizing using Nginx
Replacing and searching text in Nginx response
Assembling ZIP files on the fly
Using Nginx as a HTTP publish-subscribe server
Transforming XML responses using XSLT templates
Setting up Etags for static content
Easy logging of page load times
Streaming of MP4/H.264 files
Setting up SCGI sites
Setting up expiring links
Chapter 10: Some More Third-party Modules
Introduction
Configuring a fair load balancing
Setting up health checks for backend servers
Tracking and reporting file upload progress
Generating circles for round edges using Nginx
Running Python using Phusion Passenger
Generating graphs directly from RRDtool in Nginx
Using Google performance tools
Serving content directly from GridFS
Configuring Basic HTTP auth using PAM
Configuring Basic HTTP auth using Kerberos

Book Details

ISBN 139781849514965
Paperback236 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Nginx HTTP Server Book Cover
Nginx HTTP Server
$ 26.99
$ 2.70
PostgreSQL 9.0 High Performance Book Cover
PostgreSQL 9.0 High Performance
$ 29.99
$ 21.00
Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40
PostgreSQL 9 Admin Cookbook Book Cover
PostgreSQL 9 Admin Cookbook
$ 29.99
$ 21.00
Mastering Nginx Book Cover
Mastering Nginx
$ 26.99
$ 18.90
Responsive Web Design with HTML5 and CSS3 Book Cover
Responsive Web Design with HTML5 and CSS3
$ 23.99
$ 4.80