Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
}

http    {
include /etc/nginx/mime.types;
default_type application/octet-stream;

                access_log      /var/log/nginx/access.log;

                sendfile                                on;

                tcp_nopush                  on;
#tcp_nodelay on;

                #keepalive_timeout      0;
keepalive_timeout 65;

                gzip        on;

                include /etc/nginx/sites-enabled/*;
}

The nginx.conf file contains these parts:


user—Sets   the system  user    that    will    be  used    to  run Nginx.  This    is  www-
data by default. You can add a group to this setting by inserting a
second entry, which in this example would be the following:
user www-data;

worker  processes—Allows    you to  set how many    processes   Nginx
may spawn on your server. The default value of 1 is fine for most users,
although some recommend setting this as high as 4. You can experiment
but do so carefully.
error_log—This is commented out in this example. You can set the
location for an error log by removing the # that marks the line as a
comment that should not be processed by Nginx and adjusting the listed
directory location, if you don’t want to use the default log location.
events and worker_connections—These settings adjust how
many concurrent connections Nginx will allow per process. It may be
helpful to think of it this way: worker_connections times
worker_processes will give you the maximum number of clients
that may connect to your server concurrently. Memory plays a factor in
whether your server can actually serve all the permitted connections you
configure, so if you aren’t sure whether your server has enough memory
to go higher, leave both settings at their defaults, and you should be fine.
Free download pdf