Home Page Icon
Home Page
Table of Contents for
NGINX High Performance
Close
NGINX High Performance
by Rahul Sharma
NGINX High Performance
NGINX High Performance
Table of Contents
NGINX High Performance
Credits
About the Author
About the Reviewers
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. Working with NGINX
The NGINX architecture
Installing NGINX from source
Build requirements
The ANSI C compiler and build system
libatomic_ops and AIO – optional requirements
Perl – an optional requirement
The Perl Compatible Regular Expressions library – an optional requirement
OpenSSL – an optional requirement
Zlib – an optional requirement
Configuring NGINX
Configuring NGINX defaults
Configuring NGINX modules
Configuring NGINX for the Web
Configuring NGINX for e-mail
Configuring third-party modules
NGINX – the complete package
Building and installing NGINX
Deploying in NGINX
Deploying NGINX
Summary
2. Benchmarking the Server
Performance testing
Using timeouts
Baselines
A note about tools
Generating metrics using Siege
Installing Siege
Running Siege
Siege test results
Generating metrics using Apache JMeter
Installing JMeter
Installing Java
Setting JAVA_HOME
Running JMeter
Components of JMeter
Threads
Sampler
Configuration elements
Assertions
Listeners
Test plan
Building JMeter test plans
JMeter test results
Summary
3. Tweaking NGINX Configuration
NGINX configuration syntax
Configuring NGINX workers
worker_processes
accept_mutex
accept_mutex_delay
worker_connections
worker_rlimit_nofile
multi_accept
use
Configuring NGINX I/O
Sendfile
Direct I/O
Asynchronous I/O
Mixing them up
Configuring TCP
TCP_NODELAY
TCP_CORK
Setting them up
Setting up the server
Measuring gains
Summary
4. Controlling Buffers, Timeouts, and Compression
Configuring buffers
client_body_buffer_size
client_max_body_size
client_body_in_file_only
client_body_in_single_buffer
client_body_temp_path
client_header_buffer_size
large_client_header_buffers
Configuring timeouts
keepalive
keepalive_timeout
keepalive_requests
keepalive_disable
send_timeout
client_body_timeout
client_header_timeout
Compression
ngx_http_gzip_module
gzip
gzip_comp_level
gzip_min_length
gzip_types
gzip_proxied
gzip_http_version
gzip_vary
gzip_disable
ngx_http_gzip_static_module
gzip_static
ngx_http_gunzip_module
gunzip
Configuring logs
access_log
log_format
log_subrequest
error_log
log_not_found
Setting up the server
Measuring gains
Summary
5. Configuring the Network Stack
TCP buffers
The TCP window
TCP control algorithms
TCP states
Raising server limits
The queue size
The listen socket queue size
Half-opened connections
Ephemeral ports
Open files
Setting up the server
Summary
6. Using NGINX Cache
Caching static content
open_file_cache
open_file_cache_valid
open_file_cache_min_uses
open_file_cache_errors
Setting up the server
Caching dynamic content
Using FastCGI and the related cache
Installing PHP
Deploying PHP scripts
Configuring php-fpm
Configuring NGINX FastCGI
fastcgi_pass
fastcgi_param
fastcgi_index
fastcgi_split_path_info
fastcgi_bind
fastcgi_ignore_headers
fastcgi_pass_request_headers / fastcgi_pass_request_body
fastcgi_connect_timeout / fastcgi_send_timeout / fastcgi_read_timeout
fastcgi_store / fastcgi_store_access
Setting up the server
Configuring the FastCGI cache
fastcgi_cache_path
fastcgi_cache_key
fastcgi_cache
fastcgi_cache_valid
fastcgi_no_cache
fastcgi_cache_bypass
fastcgi_cache_methods
fastcgi_cache_use_stale
Setting up the server
Using Proxy and the related cache
Installing Python and Flask
Building a Python application
Configuring NGINX Proxy
proxy_pass
proxy_method
proxy_set_header
proxy_http_version
proxy_pass_request_headers / proxy_pass_request_body
proxy_ignore_headers
proxy_connect_timeout / proxy_send_timeout / proxy_read_timeout
proxy_store / proxy_store_access
proxy_cache_path
proxy_cache_key
proxy_cache
proxy_cache_valid
proxy_no_cache
proxy_cache_bypass
proxy_cache_methods
proxy_cache_use_stale
Setting up the server
Using Memcache
memcached_pass
memcached_connect_timeout / memcached_send_timeout / memcached_read_timeout
memcached_bind
Setting up the server
Measuring gains
Summary
7. Extending NGINX
The Lua scripting language
The NGINX Lua module
Installation
Directives
lua_package_path
lua_shared_dict
init_by_lua/init_by_lua_file
set_by_lua/set_by_lua_file
content_by_lua/content_by_lua_file
header_filter_by_lua/header_filter_by_lua_file
body_filter_by_lua/body_filter_by_lua_file
access_by_lua/access_by_lua_file
rewrite_by_lua/rewrite_by_lua_file
log_by_lua/log_by_lua_file
The NGINX-Lua API
ngx.arg
ngx.var.varName
ngx.say/ngx.print
ngx.location.capture/ngx.location.capture_multi
ngx.ctx
ngx.status
ngx.header.HeaderField
ngx.req.functions
ngx.shared.DictionaryName
ngx.socket.tcp
NGINX Lua libraries
Setting up the server
The problem statement
Statement
Summary
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Table of Contents
Next
Next Chapter
NGINX High Performance
NGINX High Performance
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset