Full sample configuration

What follows is a sample configuration file, including the different sections discussed in this chapter. Please note that this should not be copy-pasted and used as-is. It will most likely not fit your needs. This code is shown here only to give an idea of the structure of a complete configuration file:

user www; worker_processes 12; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { use /dev/poll; worker_connections 2048; } http { include /opt/local/etc/nginx/mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; server_names_hash_max_size 1024; server { listen 80; return 444; } server { listen 80; server_name www.example.com; location / { ...

Get Mastering NGINX - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.