Git Product home page Git Product logo

ansible-nginx-site's Introduction

Ansible Role: nginx-site

Build Status

This Role is used to configure individual Nginx vhost-sites stored in /etc/nginx/sites-available/

Configuration

General

Parameter Required Default Options / Comment
site_name no "example.org"
ip_version no both both, IPv4, IPv6
http_port no 80 0 - 65535
https_port no 443 0 - 65535
aliases no [{{site_name}}] List of strings with domain names (Wildcard *)
log_access_file no /var/log/nginx/{{site_name}}_access.log
log_error_file no /var/log/nginx/{{site_name}}_error.log
log_level no error debug, info, notice, warn, error, crit, alert, or emerg
nginx_disable_default_site no true true disables the default nginx vhost
nginx_use_ppa no false Debian-based systems only If true, the official nginx development package sources will be used.
nginx_ppa_version no stable stable or develop

Nginx from official development PPA

When enabling the nginx_usa_ppa option, keep in mind this upgrades the globally installed nginx and might affect other nginx-sites. A downgrade option is not provided, but manually deleting the packet source and re-installing nginx on the specific host should rollback the changes.

Encryption

When encryption is not explicitly disabled all ssl_ prefixed options are required. The default values harmonize with the ansible-letsencrypt role by @jaywink.

Parameter Required Default Options / Comment
encryption no "redirect" force, redirect, optional, off
ssl_ciphers yes EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH [see]
ssl_protocols yes TLSv1 TLSv1.1 TLSv1.2 [see]
ssl_certificate_path yes /etc/letsencrypt/live/{{site_name}}/fullchain.pem defaults to LetsEncrypt
ssl_trusted_certificate_path yes /etc/letsencrypt/live/{{site_name}}/fullchain.pem defaults to LetsEncrypt, needed for OCSP Stapling
ssl_key_path yes /etc/letsencrypt/live/{{site_name}}/privkey.pem defaults to LetsEncrypt
ssl_dh_size yes 4096 this will take a while to generate
ssl_dh_file yes /etc/ssl/certs/dhparam-{{ ssl_dh_size }}.pem consider pre-generating this file
ssl_hsts_max_age yes 604800 (1 week) encryption must be set to force or redirect
ssl_hsts_enabled no true This is only enabled when encryption is set to force or redirect

|

Features

Each vhost-site can have it's own purpose, while only one feature at a time can be used. (To build more complex configurations, custom templates are the better option.)

All options are grouped in a dict structure called features.

serve_htdocs

Enabling this feature configures the vhost to serve static content

- role: gronke.nginx-site
  features:
    serve_htdocs:
      document_root: /var/www

optionally PHP can be installed and enabled too

- role: gronke.nginx-site
  features:
    serve_htdocs:
      document_root: /var/www
      php: true
      index: 'index.html index.php'

proxy

Incoming requests are proxied to a different http(s) server. Very useful when the Nginx vhost is acting as SSL proxy for other services.

- role: gronke.nginx-site
  features:
    proxy:
      target: 'http://example.com'
      rewrite_rules:
        - '^/foo(.*)$ /bar$1'

seafile_fastcgi

Seafile wants a lot extra configuration. This feature is planned to be deprecated in future versions and replaced with a more generic solution for complex configurations.

- role: gronke.nginx-site
  features:
    seafile_fastcgi:
      seafile_org_name: 'My Organization'

ansible-nginx-site's People

Contributors

gronke avatar robbyoconnor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.