Ansible for clean wordpress host setup
inventory | ||
roles | ||
vars | ||
ansible.cfg | ||
README.md | ||
setup_server.yml |
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:
- Update Ubuntu packages
- Install Nginx
- Configure Nginx with hardened vhost settings
- Install PHP
- Configure PHP
- Install WordPress
- Install Docker
- 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.