nginx Attributes - AWS OpsWorks

nginx Attributes

Important

The AWS OpsWorks Stacks service reached end of life on May 26, 2024 and has been disabled for both new and existing customers. We strongly recommend customers migrate their workloads to other solutions as soon as possible. If you have questions about migration, reach out to the AWS Support Team on AWS re:Post or through AWS Premium Support.

Note

These attributes are available only on Linux stacks.

The nginx attributes specify the Nginx configuration. For more information, see Directive Index. For more information on how to override built-in attributes to specify custom values, see Overriding Attributes.

binary

The location of the Nginx binaries (string). The default value is '/usr/sbin/nginx'.

node[:nginx][:binary]
dir

The location of files such as configuration files (string). The default value is '/etc/nginx'.

node[:nginx][:dir]
gzip

Whether gzip compression is enabled (string). The possible values are 'on' and 'off'. The default value is 'on'.

Warning

Compression can introduce security risks. To completely disable compression, set this attribute as follows:

node[:nginx][:gzip] = 'off'
node[:nginx][:gzip]
gzip_comp_level

The compression level, which can range from 1–9, with 1 corresponding to the least compression (string). The default value is '2'.

node[:nginx][:gzip_comp_level]
gzip_disable

Disables gzip compression for specified user agents (string). The value is a regular expression and the default value is 'MSIE [1-6].(?!.*SV1)'.

node[:nginx][:gzip_disable]
gzip_http_version

Enables gzip compression for a specified HTTP version (string). The default value is '1.0'.

node[:nginx][:gzip_http_version]
gzip_proxied

Whether and how to compress the response to proxy requests, which can take one of the following values (string):

  • 'off': do not compress proxied requests

  • 'expired': compress if the Expire header prevents caching

  • 'no-cache': compress if the Cache-Control header is set to "no-cache"

  • 'no-store': compress if the Cache-Control header is set to "no-store"

  • 'private': compress if the Cache-Control header is set to "private"

  • 'no_last_modified': compress if Last-Modified is not set

  • 'no_etag': compress if the request lacks an ETag header

  • 'auth': compress if the request includes an Authorization header

  • 'any': compress all proxied requests

The default value is 'any'.

node[:nginx][:gzip_proxied]
gzip_static

Whether the gzip static module is enabled (string). The possible values are 'on' and 'off'. The default value is 'on'.

node[:nginx][:gzip_static]
gzip_types

A list of MIME types to be compressed (list of string). The default value is ['text/plain', 'text/html', 'text/css', 'application/x-javascript', 'text/xml', 'application/xml', 'application/xml+rss', 'text/javascript'].

node[:nginx][:gzip_types]
gzip_vary

Whether to enable a Vary:Accept-Encoding response header (string). The possible values are 'on' and 'off'. The default value is 'on'.

node[:nginx][:gzip_vary]
keepalive

Whether to enable a keep-alive connection (string). The possible values are 'on' and 'off'. The default value is 'on'.

node[:nginx][:keepalive]
keepalive_timeout

The maximum amount of time, in seconds, that a keep-alive connection remains open (number). The default value is 65.

node[:nginx][:keepalive_timeout]
log_dir

The location of the log files (string). The default value is '/var/log/nginx'.

node[:nginx][:log_dir]
user

The user (string). The default values are as follows:

  • Amazon Linux and RHEL: 'www-data'

  • Ubuntu: 'nginx'

node[:nginx][:user]
server_names_hash_bucket_size

The bucket size for hash tables of server names, which can be set to 32, 64, or 128 (number). The default value is 64.

node[:nginx][:server_names_hash_bucket_size]
worker_processes

The number of worker processes (number). The default value is 10.

node[:nginx][:worker_processes]
worker_connections

The maximum number of worker connections (number). The default value is 1024. The maximum number of clients is set to worker_processes * worker_connections.

node[:nginx][:worker_connections]