Nginx sample configuration files for common use cases, like serving static files, proxying and talking to fastcgi or uswgi services.
Common use-case nginx configurations
Nginx is an event-driven webserver / reverse-proxy capable of handling many concurrent requests with relative ease.
This repo provides some boilerplate examples and recipe for getting started at configuring nginx for common use-cases, e.g. serving static files fast and efficient.
All recipe take best practice into account and try not to repeat mistakes outlined in IfIsEvil and CommonPitfalls.
It is recommended to always use the latest stable version of nginx. At the time of this writing this is version 1.0.0.
Installation
The repository can be cloned with git clone https://github.com/macedigital/nginx-recipe.git
.
Usage
- Put ‘recipe’, ‘sites-available’ and ‘sites-enabled’ folders into nginx configuration directory
- Pick an example vhost config and replace
server_name
androot
directives with appropiate values - Symlink wanted vhost config in sites-enabled folder, make sure it ends with .conf
- If not already done so, update your main nginx configuration file ‘nginx.conf’ with
include sites-enabled/*.conf
- Reload nginx
killproc /usr/sbin/nginx -HUP
Credits
Inspiration came from others having had similar ideas, most notably:
Disclaimer
These recipe work for me and may not work for you. If you think you spotted an error or have suggestions for improvements just drop me a note.