You are previewing Nginx 1 Web Server Implementation Cookbook.

Nginx 1 Web Server Implementation Cookbook

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

Setting up HTTPS for a simple site

Cryptography has evolved over the ages and in today's world public key cryptography is pretty much the cutting edge (this is what PGP is based upon). All browsers implement certificate based security, allowing for safe and encrypted transactions on the Internet. It has proven to be one of the key factors contributing to the growth of e-commerce over the last decade.

Just as most browsers implement SSL based client mechanisms, all web servers also need to handle the server end of things. Nginx has a very clean and easy-to-configure implementation of SSL-based security. In this recipe we will have a look at how easy it is to get a pair of certificates and quickly set up a secure site.

How to do it...

  1. Initially, ...

The best content for your career. Discover unlimited learning on demand for around $1/day.