stancel.nginx_site_setup

nginx_site_setup

This is an Ansible role that helps you set up one or more new virtual hosts on an NginX web server.

Requirements

You need to have NginX installed and running on the server where you use this role.

Role Variables

Here are the settings for the sites you want to set up on the web server:

    nginx_site_setup_sites_to_set_up:
      - {
          url: 'mysite.com',
          name: 'mysite',
          https: true,
          site_subfolder_used_to_serve_files: "current/build/html",
          restrict_site_to_certain_ip_addresses: true,
          ip_addresses_or_cidr_ranges_to_allow_or_deny: [
            "allow 1.2.3.4;",
            "allow 192.168.1.0/24",
            "deny all;"
          ]   
        }

You can set the maximum size for client requests to NginX. The default limit is 10 MB.

    nginx_site_setup_nginx_server_client_max_body_size: 10m

This is the main directory for the web server files. The default is "/var/www".

    nginx_site_setup_web_home: "/var/www"

This is the name of the folder created for each website to store the files NginX will serve. The default is "www". If you’re using Bedrock WordPress, change it to "web".

    nginx_site_setup_site_subfolder_used_to_serve_files: "www"

The Linux username that your web server will use. The default is "www-data".

    nginx_site_setup_web_user: "www-data"

The Linux group that your web server will use. The default is "www-data".

    nginx_site_setup_web_group: "www-data"

Specify if this role is being used on a shared web server. If so, it will expect that the web user is different from the web group. The default is false.

    nginx_site_setup_used_on_shared_webserver: false

Determine if the site should only be available on a private network, for certain IP addresses, or if all should be blocked. The default is false.

    nginx_site_setup_restrict_site_to_certain_ip_addresses: false

Specify the PHP version you are using with NginX. The default is "8.1".

    nginx_site_php_version: "8.1"

The rules for allowing or denying access are processed from top to bottom.

    nginx_site_setup_ip_addresses_or_cidr_ranges_to_allow_or_deny: [
      "allow 1.2.3.4;",
      "allow 192.168.1.0/24",
      "deny all;"
    ]

Dependencies

There are no dependencies.

Example Playbook

Here’s how you can use this role with an example playbook:

    - hosts: your_webserver
      vars_files:
        - vars/main.yml
      roles:
        - stancel.nginx_site_setup 

Or by directly including the variables in the playbook:

    - hosts: your_webserver 
      vars:
        nginx_site_setup_sites_to_set_up:
          - {
              url: 'mysite.com',
              name: 'mysite',
              https: true,
              nginx_site_setup_used_on_shared_webserver: true,
              site_subfolder_used_to_serve_files: "current/build/html",
              restrict_site_to_certain_ip_addresses: true,
              ip_addresses_or_cidr_ranges_to_allow_or_deny: [
                "allow 1.2.3.4;",
                "allow 192.168.1.0/24",
                "deny all;"
              ]
            }
      roles:
        - stancel.nginx_site_setup

License

This role is licensed under GPLv3.

Author Information

Brad Stance

Informazioni sul progetto

Sets up one or more new virtual hosts on an NginX webserver

Installa
ansible-galaxy install stancel.nginx_site_setup
Licenza
Unknown
Download
136
Proprietario