Skip to content

Commit

Permalink
Improved comments in the Nginx config regarding in the workers/events
Browse files Browse the repository at this point in the history
  • Loading branch information
sirupsen authored and robrighter committed Oct 27, 2010
1 parent 6746037 commit f6ad27a
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions nginx.conf
@@ -1,28 +1,45 @@
# Default Nginx user for security reasons
# Set another default user than root for security reasons
user www www;

# You generally only need one worker, unless you're serving
# large amounts of static files which require blocking disk reads
# As a thumb rule: One per CPU. If you are serving a large amount
# of static files, which requires blocking disk reads, you may want
# to increase this from the number of cpu_cores available on your
# system.
#
# The maximum number of connections for Nginx is calculated by:
# max_clients = worker_processes * worker_connections
worker_processes 1;

# Maximum file descriptors that can be opened per process
# This should be > worker_connections
worker_rlimit_nofile 8192;

events {
worker_connections 1024; # Increase if you have *a lot* of clients
accept_mutex off; # "on" if you have worker_processes > 1
# When you need > 8000 * cpu_cores connections, you start optimizing
# your OS, and this is probably the point at where you hire people
# who are smarter than you, this is *a lot* of requests.
worker_connections 8000;

# This sets up some smart queueing for accept(2)'ing requests
# Set it to "on" if you have > worker_processes
accept_mutex off;

# These settings are OS specific, by defualt Nginx uses select(2),
# however, for a large number of requests epoll(2) and kqueue(2)
# are generally faster than the default (select(2))
# use epoll; # enable for Linux 2.6+
# use kqueue; # enable for *BSD (FreeBSD, OS X, ..)
}

# Change these to somewhere that suits you
# Change these paths to somewhere that suits you!
error_log logs/error.log;
pid logs/nginx.pid;

http {
# Set the mime-types
include mime.types;

# Fallback mime-type
# And the fallback mime-type
default_type application/octet-stream;

# Format for our log files
Expand Down Expand Up @@ -63,6 +80,8 @@ http {
# listen 80 default accept_filter=httpready; # for FreeBSD
listen 80 default;

# e.g. "localhost" to accept all connections, or "www.example.com"
# to handle the requests for "example.com" (and www.example.com)
server_name _;

# Path for static files
Expand All @@ -86,9 +105,4 @@ http {
}
}
}

server {
server_name www.example.com;
rewrite ^(.*) http://example.com$1 permanent;
}
}

0 comments on commit f6ad27a

Please sign in to comment.