How create several installations of WordPress independents?

November 23, 2019 164 views
Apache WordPress LEMP

I use Digital Ocean about one year. I want create a a service to sell small websites using WordPress as CMS, alright a simple service/panel using Digital Ocean API to create a new domain in apache, database and some configurations.

But I have a HUUUGGGGEEEE question, how create isolated configuration for each domain? Example: Imagine one of this small website infected or hacked. This will create a huge problem for all users.

Exists any tool, to deny one user/website to access other directories/files from other user/website?

== My scenario

1 Droplet to MySQL
1 Droplet to Apache/PHP
1 Droplet to Webmail Domains

*Apache (virtual sever) and MySQL databases are created by API

Directories structure

/var/www/domain1.com/[website files]

/var/www/domain2.com/[website files]

/var/www/domain3.com/[website files]

1 Answer

Hello,

With the DigitalOcean API you could, for example, create separate droplets:

https://developers.digitalocean.com/documentation/v2/#droplets

But once the droplet is created you would need your own automation in order to make changes to your Apache config. For example, you could use Ansible or BASH scripts to automate the creation of Apache Virtual Hosts.

Here’s a step by step guide on how to host multiple websites on 1 droplet with Apache Vhosts:

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04

Hope that this helps!
Regards,
Bobby

by Brennen Bearnes
The Apache web server is the most popular way to serve web content on the internet. Apache has the ability to serve multiple domains from a single server by using a mechanism called "virtual hosts". If a virtual host is configured correctly for each domain, the web server can correctly route traffic to the appropriate files based on the domain name requested. In this guide, we'll demonstrate how to configure Apache virtual hosts on an Ubuntu 16.04 server.
  • Is possible using the same droplets? Example, lightspeed panel allow create several accounts for websites in only one droplet… I want something like that.

    • Hello,

      Yes with Apache you could create multiple virtual hosts and that way you can host multiple websites.

      Hope that this helps!
      Regards,
      Bobby

      • Already using virtual host, but when one website was hacked all others websites too infected and this is my problem “how isolates each website as unic?”

        • Hello,

          In this case I could suggest using an Apache module like RUID2 which lets you setup Apache to run as different users.

          That way you could have a separate user for each site, for example user1, user2, user3 and etc, then your the Vhost for each website would be pointed to the specific user:

          /home/user1/public_html
          /home/user3/public_html
          /home/user2/public_html
          ...
          

          That way thanks to RUID2 even if for example user1 gets hacked, it would not affect the rest of the users as the user1 would not have access and privileges to edit/view the other files.

          Hope that this helps!
          Regards,
          Bobby

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!