Technical Documentation: h5bp/server-configs-nginx
โน๏ธ Provenance: Multi-Tier Ingestion ยท CodeWiki Reference
Overview (`README.md`)
[Nginx Server Configs](https://github.com/h5bp/server-configs-nginx)
Nginx Server Configs is a collection of configuration files that can help
your server improve the website's performance and security, while also
ensuring that resources are served with the correct content-type and are
accessible, if needed, even cross-domain.
Getting Started
Using the Nginx server configs repo directly has a few required steps to be able to work.
Check `nginx.conf` settings
The first thing to check is that the nginx.conf file contains appropriate values for
your specific install.
Most specific variables are:
usererror_logpidaccess_log
Nginx test and restart
To verify Nginx config
shellnginx -tTo verify Nginx config with a custom file
shellnginx -t -c nginx.confTo reload Nginx and apply the new config
shellnginx -s reload
Repository structure
This repository has the following structure:
./
โโโ conf.d/
โ โโโ default.conf
โ โโโ templates/
โโโ h5bp/
โ โโโ basic.conf
โ โโโ location/
โ โโโ .../
โโโ custom.d/
โ โโโ .../
โโโ mime.types
โโโ nginx.confconf.d/This directory should contain all the
serverdefinitions.Except if they are dot prefixed or non
.confextension, all files in this
directory are loaded automatically.templatesfolderFiles in this directory contain a
servertemplate for secure and non-secure
hosts. They are intended to be copied in theconf.ddirectory with allexample.comoccurrences changed to the target host.
h5bp/This directory contains config snippets (mixins) to be included as desired.
There are two types of config files provided: individual config snippets and
combined config files which provide convenient defaults.basic.confThis file loads a small subset of the rules provided by this repository to add
expiresheaders, allow cross-domain fonts and protect system files from web
access.
Thebasic.conffile includes the rules which are recommended to always be
defined.location/Files in this directory contain one or more
locationdirectives. They are
intended to be loaded in theservercontext (or, in a nestedlocationblock).
custom.d/This directory should contain all the custom
nginx.confconfiguration.Except if they are dot prefixed or non
.confextension, all files in this
folder are loaded automatically.mime.typesThe
mime.typesfile is responsible for mapping file extensions to MIME types.nginx.confThe main Nginx config file.
Usage
As a reference
To use as reference requires no special installation steps, download/checkout the
repository to a convenient location and adapt your existing Nginx configuration
incorporating the desired functionality from this repository.
Download the latest release archive.
Directly
To use directly, replace the Nginx config directory with this repository.
For example:
nginx -s stop
cd /etc
mv nginx nginx-previous
git clone https://github.com/h5bp/server-configs-nginx.git nginx
# install-specific edits
nginxManage sites
cd /etc/nginx/conf.dCreating a new site
bashcp templates/example.com.conf .actual-hostname.conf sed -i 's/example.com/actual-hostname/g' .actual-hostname.confEnabling a site
bashmv .actual-hostname.conf actual-hostname.confDisabling a site
bashmv actual-hostname.conf .actual-hostname.conf
nginx -s reloadSupport
- Nginx v1.8.0+
Contributing
Anyone is welcome to contribute,
however, if you decide to get involved, please take a moment to review
the guidelines:
Acknowledgements
Nginx Server Configs is
only possible thanks to all the awesome
contributors!
License
The code is available under the MIT license.
--- METRICS ---
- Files Extracted: 1
- Estimated Token Budget: ~1169 tokens
- Canonical Reference: https://codewiki.google/github.com/h5bp/server-configs-nginx