Nginx HTTP Server - Third Edition
eBook - ePub

Nginx HTTP Server - Third Edition

Clement Nedelcu

Share book
  1. 318 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Nginx HTTP Server - Third Edition

Clement Nedelcu

Book details
Book preview
Table of contents
Citations

About This Book

Harness the power of Nginx to make the most of your infrastructure and serve pages faster than everAbout This Book• Discover possible interactions between Nginx and Apache to get the best of both worlds• Learn to exploit the features offered by NGinx for your web applications• Get the newest techniques available, designed with the latest version in mindWho This Book Is ForBy covering both the early setup stages and advanced topics, this book suits web administrators who interested in solutions to optimize their infrastructure, whether you are looking into replacing your existing web server software or integrating a new tool to cooperate with applications that are already up and running. If you, your visitors, and your operating system have been disappointed by Apache, this book is exactly what you need.What You Will Learn• Get to know the basics of the Nginx configuration: syntax, structure, and semantics• Understand the advanced load balancing functionality of Nginx and the newest innovative IO mechanisms• Create virtual host configurations effortlessly• Discover all the first-party modules: how to enable, configure, and use them• Establish advanced rewrite rules with the Nginx Rewrite module• Set up Nginx to work with PHP, Python, and more via FastCGI• Configure Nginx to work as frontend for your existing HTTP server• Manipulate configuration files with ease and adapt them to various situations• Discover the common pitfalls and find out how to avoid themIn DetailNginx is a lightweight HTTP server designed for high-traffic websites, with network scalability as the primary objective. With the advent of high speed Internet access, short loading times and fast transfer rates have become a necessity. This free, open source solution will either come as a full replacement of other software such as Apache, or stand in front of your existing infrastructure to improve its overall speed.This book is a detailed guide to setting up Nginx in different ways that correspond to actual production situations: as a standalone server, as a reverse proxy, interacting with applications via FastCGI, and more. In addition, this complete directive reference will be your best friend at all stages of the configuration and maintenance processes.This book is the perfect companion for both Nginx beginners and experienced administrators. For beginners, it will take you through the complete process of setting up this lightweight HTTP server on your system and configuring its various modules so it does exactly what you need quickly and securely. For more experienced administrators, this book provides different approaches that can help you make the most of your current infrastructure. Nginx can be employed in many situations, whether you are looking to construct an entirely new web-serving architecture or simply want to integrate an efficient tool to optimize your site loading speeds.Style and approachThis tutorial-style book includes detailed instructions on each of the processes it describes, as well as step-by-step tutorials, commented configuration sections, and in-depth module descriptions, so you can make the most of the performance potential offered by Nginx.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Nginx HTTP Server - Third Edition an online PDF/ePUB?
Yes, you can access Nginx HTTP Server - Third Edition by Clement Nedelcu in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Programación de código abierto. We have over one million books available in our catalogue for you to explore.

Information

Nginx HTTP Server Third Edition


Table of Contents

Nginx HTTP Server Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Downloading and Installing Nginx
Setting up the prerequisites
The GNU Compiler Collection
The PCRE library
The zlib library
OpenSSL
Downloading Nginx
Websites and resources
Version branches
Features
Downloading and extracting
Configure options
The easy way
Path options
Prerequisites options
Module options
Modules enabled by default
Modules disabled by default
Miscellaneous options
Configuration examples
About the prefix switch
Regular HTTP and HTTPS servers
All modules enabled
Mail server proxy
Build configuration issues
Make sure you installed the prerequisites
Directories exist and must be writable
Compiling and installing the program
Controlling the Nginx service
Daemons and services
User and group
Nginx command-line switches
Starting and stopping the daemon
Testing the configuration
Other switches
Adding Nginx as a system service
System V scripts
About init scripts
The init script for Debian-based distributions
The init script for Red Hat–based distributions
Installing the script
Debian-based distributions
Red Hat–based distributions
NGINX Plus
Summary
2. Basic Nginx Configuration
Configuration file syntax
Configuration directives
Organization and inclusions
Directive blocks
Advanced language rules
Directives accept specific syntaxes
Diminutives in directive values
Variables
String values
Base module directives
What are base modules?
The Nginx process architecture
Core module directives
The Events module
The Configuration module
Necessary adjustments
Testing your server
Creating a test server
Performance tests
Httperf
Autobench
OpenWebLoad
Upgrading Nginx gracefully
Summary
3. HTTP Configuration
The HTTP Core module
Structure blocks
Module directives
Socket and host configuration
listen
server_name
server_name_in_redirect
server_names_hash_max_size
server_names_hash_bucket_size
port_in_redirect
tcp_nodelay
tcp_nopush
sendfile
sendfile_max_chunk
send_lowat
reset_timedout_connection
Paths and documents
root
alias
error_page
if_modified_since
index
recursive_error_pages
try_files
Client requests
keepalive_requests
keepalive_timeout
keepalive_disable
send_timeout
client_body_in_file_only
client_body_in_single_buffer
client_body_buffer_size
client_body_temp_path
client_body_timeout
client_header_buffer_size
client_header_timeout
client_max_body_size
large_client_header_buffers
lingering_time
lingering_timeout
lingering_close
ignore_invalid_headers
chunked_transfer_encoding
max_ranges
MIME types
types
default_type
types_hash_max_size
types_hash_bucket_size
Limits and restrictions
limit_except
limit_rate
limit_rate_after
satisfy
internal
File processing and caching
disable_symlinks
directio
directio_alignment
open_file_cache
open_file_cache_errors
open_file_cache_min_uses
open_file_cache_valid
read_ahead
Other directives
log_not_found
log_subrequest
merge_slashes
msie_padding
msie_refresh
resolver
resolver_timeout
server_tokens
underscores_in_headers
variables_hash_max_size
variables_hash_bucket_size
post_action
Module variables
Request headers
Response headers
Nginx generated
The location block
Location modifier
The = modifier
No modifier
The ~ modifier
The ~* modifier
The ^~ modifier
The @ modifier
Search order and priority
Case 1
Case 2
Case 3
Summary
4. Module Configuration
The Rewrite module
Reminder on regular expressions
Purpose
PCRE syntax
Quantifiers
Captures
Internal requests
error_page
Rewrite
Infinite loops
Server Side Includes
Conditional structure
Directives
Common rewrite rules
Performing a search
User profile page
Multiple parameters
Wikipedia-like
News website article
Discussion board
SSI module
Module directives and variables
SSI command...

Table of contents