/etc/nginx/
Nginx keeps it’s configuration in the expected /etc/nginx directory. This directory is broken up as follows:
Path | Purpose | Ref. |
./conf.d/*.conf | Extra configuration files. | #conf.d, #appincludes |
./fastcgi.conf | Commonly configured directives (nginx packaging team) | #params |
./fastcgi_params | Commonly configured directives (upstream version) | #params |
./koi-utf | Nginx Character Set | #charset |
./koi-win | Nginx Character Set | #charset |
./mime.types | Maps file name extensions to MIME types of responses | #mimetypes |
./nginx.conf | The primary configuration file. | #nginx.conf |
./proxy_params | Commonly configured directives | #params |
./scgi_params | Commonly configured directives | #params |
./sites-available/* | Extra virtual host configuration files | – |
./sites-enabled/* | Symlink to sites-available/<file> to enable vhost | – |
./snippets/*.conf | Configuration snippets that can be included in configs | – |
./apps.d/*.conf | Files included by /etc/nginx/sites-available/default | #appincludes |
./uwsgi_params | Commonly configured directives | #params |
./win-utf | Nginx Character Set |
When Nginx is installed on a Debian-based system, it creates a number of files and directories. The main configuration file is located at /etc/nginx/nginx.conf
, and includes various directives that determine how the server operates. The sites-available
directory contains configuration files for individual websites or virtual hosts, while the sites-enabled
directory contains symlinks to the active configuration files for currently enabled sites.
The conf.d
directory contains additional configuration files that are included in the main nginx.conf
file. These files can be used to define global directives that apply to all sites or to include additional configuration files.
The sites-available
and sites-enabled
directories are often used in conjunction with the nginx -s reload
command, which reloads the server configuration without stopping the server itself. To enable a site, a symlink to its configuration file must be created in the sites-enabled
directory. Conversely, to disable a site, the symlink should be removed.
The html
directory contains the default website for Nginx. This directory contains an index.html
file that is served when a client accesses the server’s root directory. By default, the html
directory is located at /usr/share/nginx/html
.
Finally, the logs
directory contains the server’s log files. These files can be used to diagnose problems with the server or to track server activity. By default, the access log is located at /var/log/nginx/access.log
and the error log is located at /var/log/nginx/error.log
.
The modules-available
directory contains configuration files for individual Nginx modules. These files can be used to enable or disable specific modules by creating or removing symlinks in the modules-enabled
directory. By default, all available modules are enabled, but disabling unnecessary modules can help to reduce server resource usage.
The conf.d
directory is used to include additional configuration files that are not specific to any particular website or virtual host. These files typically contain global configuration directives that apply to all sites, such as settings for logging, compression, or caching.
In addition to the main nginx.conf
file, there are several other configuration files that can be included or overridden as needed. For example, the fastcgi_params
file contains default parameters for FastCGI servers, while the mime.types
file contains mappings of file extensions to MIME types.
The ssl
directory contains the SSL certificate and key files that are used to secure HTTPS connections. By default, these files are located at /etc/ssl/certs
and /etc/ssl/private
, respectively. It is important to keep these files secure and to renew the SSL certificate before it expires to ensure that HTTPS connections remain secure.
Overall, the file structure of Nginx on Debian-based systems is designed to provide flexibility and modularity, allowing system administrators to configure and maintain the web server to suit their specific needs.