121 lines
4.4 KiB
Nginx Configuration File
121 lines
4.4 KiB
Nginx Configuration File
# Configuration File - Nginx Server Configs
|
|
# https://nginx.org/en/docs/dirindex.html
|
|
|
|
# Run as a unique, less privileged user for security reasons.
|
|
# Default: nobody nobody
|
|
# https://nginx.org/en/docs/ngx_core_module.html#user
|
|
user www www;
|
|
|
|
# Sets the worker threads to the number of CPU cores available in the system for best performance.
|
|
# Should be > the number of CPU cores.
|
|
# Maximum number of connections = worker_processes * worker_connections
|
|
# Default: 1
|
|
# https://nginx.org/en/docs/ngx_core_module.html#worker_processes
|
|
worker_processes auto;
|
|
|
|
# Maximum number of open files per worker process.
|
|
# Should be > worker_connections.
|
|
# Default: no limit
|
|
# https://nginx.org/en/docs/ngx_core_module.html#worker_rlimit_nofile
|
|
worker_rlimit_nofile 8192;
|
|
|
|
# Provides the configuration file context in which the directives
|
|
# that affect connection processing are specified.
|
|
# https://nginx.org/en/docs/ngx_core_module.html#events
|
|
events {
|
|
|
|
# If you need more connections than this, you start optimizing your OS.
|
|
# That's probably the point at which you hire people who are smarter than you as this is *a lot* of requests.
|
|
# Should be < worker_rlimit_nofile.
|
|
# Default: 512
|
|
# https://nginx.org/en/docs/ngx_core_module.html#worker_connections
|
|
worker_connections 8000;
|
|
|
|
}
|
|
|
|
# Log errors and warnings to this file
|
|
# This is only used when you don't override it on a server{} level
|
|
# Default: logs/error.log error
|
|
# https://nginx.org/en/docs/ngx_core_module.html#error_log
|
|
error_log logs/error.log warn;
|
|
|
|
# The file storing the process ID of the main process
|
|
# Default: logs/nginx.pid
|
|
# https://nginx.org/en/docs/ngx_core_module.html#pid
|
|
pid /var/run/nginx.pid;
|
|
|
|
http {
|
|
|
|
# Hide nginx version information.
|
|
include h5bp/security/server_software_information.conf;
|
|
|
|
# Specify MIME types for files.
|
|
# https://nginx.org/en/docs/http/ngx_http_core_module.html#types
|
|
include mime.types;
|
|
|
|
# Default: text/plain
|
|
# https://nginx.org/en/docs/http/ngx_http_core_module.html#default_type
|
|
default_type application/octet-stream;
|
|
|
|
# Specify a charset
|
|
# https://nginx.org/en/docs/http/ngx_http_charset_module.html#charset
|
|
charset utf-8;
|
|
|
|
# Update charset_types to match updated mime.types.
|
|
# text/html is always included by charset module.
|
|
# Default: text/html text/xml text/plain text/vnd.wap.wml application/javascript application/rss+xml
|
|
# https://nginx.org/en/docs/http/ngx_http_charset_module.html#charset_types
|
|
charset_types
|
|
text/css
|
|
text/plain
|
|
text/vnd.wap.wml
|
|
text/javascript
|
|
application/json
|
|
application/rss+xml
|
|
application/xml;
|
|
|
|
# Include $http_x_forwarded_for within default format used in log files
|
|
# https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
# Log access to this file
|
|
# This is only used when you don't override it on a server{} level
|
|
# Default: logs/access.log combined
|
|
# https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
|
|
access_log logs/access.log main;
|
|
|
|
# How long to allow each connection to stay idle.
|
|
# Longer values are better for each individual client, particularly for SSL,
|
|
# but means that worker connections are tied up longer.
|
|
# Default: 75s
|
|
# https://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout
|
|
keepalive_timeout 20s;
|
|
|
|
# Speed up file transfers by using sendfile() to copy directly
|
|
# between descriptors rather than using read()/write().
|
|
# For performance reasons, on FreeBSD systems w/ ZFS
|
|
# this option should be disabled as ZFS's ARC caches
|
|
# frequently used files in RAM by default.
|
|
# Default: off
|
|
# https://nginx.org/en/docs/http/ngx_http_core_module.html#sendfile
|
|
sendfile on;
|
|
|
|
# Don't send out partial frames; this increases throughput
|
|
# since TCP frames are filled up before being sent out.
|
|
# Default: off
|
|
# https://nginx.org/en/docs/http/ngx_http_core_module.html#tcp_nopush
|
|
tcp_nopush on;
|
|
|
|
# Enable gzip compression.
|
|
include h5bp/web_performance/compression.conf;
|
|
|
|
# Include files in the sites-enabled folder. server{} configuration files should be
|
|
# placed in the sites-available folder, and then the configuration should be enabled
|
|
# by creating a symlink to it in the sites-enabled folder.
|
|
# See doc/sites-enabled.md for more info.
|
|
include sites-enabled/*;
|
|
|
|
}
|