Coder Social home page Coder Social logo

ansible-nginx-proxy's Introduction

Nginx proxy

Ansible recipe to configure a Nginx as proxy server. This recipe does not trying to cover all available Nginx options and just use the best practices to configure Nginx as proxy server.

Role Variables

Option Description
nginx_enabled Enable nginx service on boot.
nginx_state State of nginx service.
nginx_app_config The path to nginx application config.
app_name The name of the application, uses to create application configuration, e.g. should be a shorthand, lowercase and not contain any whitespaces.

This options are optional and bound to the application config. Feel free to define your own variables based on your configuration.

Option Description
app_ip The internal ip address of the web application.
app_port The port used by application.
app_fqdn Fully qualified domain name of the application. Non-www version.

Usage example

If the existing configuration does not satisfy your needs write your own.

upstream backend {
    server backend1.example.com       weight=5;
    server backend2.example.com:8080;
    server unix:/tmp/backend3;
}

server {
    location / {
        proxy_pass http://backend;
    }
}

Put it somewhere with your playbooks, for example into roles/nginx-proxy/templates/myapp.j2 and point to it via nginx_app_config variable.

Note about relative import

Ansible imports paths relative to the playbook you play, so this layout...

$ tree
.
├── playbook.yml
└── roles
    └── nginx-proxy
        └── templates
            └── myapp.j2

...corresponds to this option

nginx_app_config: roles/nginx-proxy/templates/myapp.j2

License

Licensed under the MIT license.

Self-Promotion

Created by Vital Kudzelka.

Open a GitHub issue if you have any suggestions or found a bug.

ansible-nginx-proxy's People

Contributors

vitalk avatar

Stargazers

 avatar  avatar

Watchers

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