GithubHelp home page GithubHelp logo

ansible-role-nginx-vhosts's Introduction

Configure nginx vhosts with Ansible

Build Status

Requirements

Nginx needs to be installed and configured, many vars and assumptions are tightly coupled with this nginx role. For Lets Encrypt support the certbot role is required.

See the full example for a complete playbook.

Example playbook

- hosts: all
  become: yes

  roles:
  - nginx
  - nginx-vhosts

  vars:
    nginx_vhosts:
    # static host serving the files under /var/www/example.com
    - host: example.com
      type: static
    # to proxy an upstream
    - host: proxy.example.com
      type: proxy # use type proxy-ws for websocket support
      target: http://localhost:3000
    # to proxy an upstream with dynamic IP
    - host: proxy.example.com
      type: proxy
      dynamic_target: http://example.local:3000
    # redirect to another domain
    - host: redirect.example.com
      type: redirect
      target: https://mysite.com
    # redirect to the www subdomain
    - host: example2.com
      type: redirect
      target: www
    # redirect to the domain without www
    - host: www.example.com
      type: redirect
      target: no-www
    # remove an upstream
    - host: www.example.com
      type: disabled
    # extra_conf can be added to all types
    - host: example.com
      type: static
      extra_conf: |
        client_max_body_size 50m;

Role variables

None of the variables below are required.

Variable Default Comment

For all options see defaults/main.yml

Development

You can use the Vagrantfile for local testing, just install vagrant and virtualbox and execute the following commands:

vagrant up
vagrant provision

TODO

  • locations support

License

MIT

ansible-role-nginx-vhosts's People

Contributors

morbidick avatar benibr 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.