Skip to content

Installation Wordpress for CentOS, Fedora, Ubuntu, Debian

Notifications You must be signed in to change notification settings

krlex/wordpress-box-nginx

Repository files navigation

WordPress + Nginx Ansible Playbook

Ansible playbook and roles for installing WordPress + Nginx + PHP + Postfix server

Requirements

  • Ansible 2.0.0 or newer
  • Ubuntu 18.04 (installed on your web server or virtual machine)

Instructions:

1. Configure your web server for ssh

Allow connections from your development machine to the web server over ssh. This is essential for ansible to work, so make sure to configure your remote or local server to allow connections via ssh. You may find ssh-copy-id helpful.

You can skip the step below if you're not using vagrant and replace 10.1.10.10 with your websever's IP address, but make sure you're able to SSH into your web server before continuing.

If you're using vagrant add these lines to your Vagrantfile:

config.vm.network :forwarded_port, guest: 80, host: 4567
config.vm.network "private_network", ip: "10.1.10.10"

This allows a connection to the machine over ssh on the specified IP address. "10.1.100.10" can be swapped out for a different IP, but make sure it matches whatever is set in your ansible inventory file.

Run vagrant ssh-config to see where your key is stored, and create or update your host machine's ~/.ssh/config file. It should looks something like this with your IdentityFile switched out:

Host 10.1.10.10
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  IdentitiesOnly yes
  User vagrant
  IdentityFile /Users/joshua/Boxes/bento/ubuntu-16.04/.vagrant/machines/default/virtualbox/private_key
  PasswordAuthentication no

Verify that you're able to ssh into the machine:

ssh vagrant@10.1.10.10

2. Clone the repository

$ git clone https://github.com/tucsonlabs/ansible-wordpress-nginx-playbook.git
$ cd /wordpress-nginx

3. Run the playbook

This tells ansible to use the inventory file we've called "hosts". If you're using vagrant you can run the same command as above but exclude the username and sudo prompt:

$ ansible-playbook -i inventory/localhost playbook.yml -c local

5. Finish the install

Open your web browser and navigate to http://10.1.10.10 (or your webserver's IP) to finish the WordPress installation.