Hello,
I currently have one droplet with ubuntu/lamp. In order to scale horizontally I would like to put MySQL on a dedicated droplet.
But I could not figure out where to start and how to secure the communication between the two droplets (ssh tunneling, vpn, …) while allowing communication between php on one side and MySQL on the other.
If someone have any guidance on this it would be great :) Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Follow <a href=“https://www.digitalocean.com/community/articles/how-to-secure-mysql-and-mariadb-databases-in-a-linux-vps”>https://www.digitalocean.com/community/articles/how-to-secure-mysql-and-mariadb-databases-in-a-linux-vps</a> on a new droplet and then secure it by configuring mysql to listen on the private network interface by editing <code>/etc/mysql/my.cnf</code> and setting bind-address to your private IP address. Finally, install a firewall on your droplet so that only your app server can connect to your MySQL server: <a href=“https://www.digitalocean.com/community/articles/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server”>https://www.digitalocean.com/community/articles/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server</a>.
I did this using CentOS. Basic workflow: <br> <br>1) Create droplet, preferably in the same private network as your web server <br>2) Configure firewall (on db server) to close ALL ports, then open port 3306 to allow database traffic ONLY from your web server’s private IP address. You will also need to open port 22 so you can SSH in. Can also restrict which IP you can SSH in from, essentially creating a tunnel to your db server via your web server (or whatever other IP you want to use). <br>3) Install MySQL and set up users <br> <br>Here’s what I did: <br>http://jessesnet.com/development-notes/2014/centos-mysql-vps-setup/
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.