Ansible for clean wordpress host setup
Go to file
David Petric e6659345e9 Syntax fix 2023-04-09 18:09:41 +02:00
inventory Bug fixes after testing 2023-03-28 10:24:45 +02:00
roles Syntax fix 2023-04-09 18:09:41 +02:00
vars Docs 2023-03-27 21:06:18 +02:00
README.md Security hardening nginx 2023-04-07 19:11:46 +02:00
ansible.cfg init 2023-03-27 16:13:41 +02:00
setup_server.yml WP Config automatic setup 2023-04-07 18:29:18 +02:00

README.md

Ansible-WordPress-Nginx-Docker

This Ansible project automates the setup and configuration of an Ubuntu machine to host a WordPress website using Nginx, PHP, Docker, MySQL, and Redis. The Nginx vhost configuration is hardened for improved security.

Features

The Ansible playbook in this project will:

  1. Update Ubuntu packages
  2. Install Nginx
  3. Configure Nginx with hardened vhost settings
  4. Install PHP
  5. Configure PHP
  6. Install WordPress
  7. Install Docker
  8. Deploy MySQL and Redis containers

Prerequisites

  • Ansible (version 2.9+)
  • Ubuntu 18.04+ target machine
  • SSH access to the target machine

Getting Started

Clone this repository to your local machine:

git clone https://github.com/your-username/ansible-wordpress-nginx-docker.git
cd ansible-wordpress-nginx-docker

Update the inventory/target.ini file with the correct information for your target Ubuntu machine:

[main]
your-server-ip ansible_ssh_user=your-username ansible_ssh_port=port ansible_ssh_private_key_file=path/to/your/private/key

Run the playbook:

ansible-playbook -i inventory/target.ini setup_server.yml

After the playbook has run successfully, you should have a fully functional WordPress website running on your Ubuntu machine with Nginx, PHP, MySQL, and Redis, with a hardened Nginx vhost configuration.

Variables

The following variables can be customized in the vars/external.yml file:

php_version: PHPversion
vhost_name: name of the vhost
domain: thedomain.com
mysql_mem_limit: 1024  //MB
mysql_mem_reserve: 512  //MB
mysql_root_pass: evenmoresecurepwd
mysql_db: projectname
mysql_user: projectname
mysql_user_pass: verysecurepwd
redis_pass: ultimatepassword

Make sure to replace the default values with your own.