Question

Am I doing Wrong? Multiple web applications on a single droplet with LAMP.

Posted December 5, 2020 396 views
MySQLApachePHPLAMP StackBuilding a SaaS

Hi All,

I have PHP web application (IE: ToDo List - (may be SaaS)), zipped and stored in out of /www folder with an sql file

If a client subscribe using mysite.com/pricing page system will create a directory for the client as /www/clients.mysite.com/client-biz-name-ID/ and unzip the master application and then create database as *client_ID *and import the above sql file in to that.

Meantime it will update the connect.php file with new database name. User and password will be same every time (pre-built one).

After that it will email the client the url to access the application with their login credentials.
IE: https://clinets.mysite.com/123-company-pty-9qw8272394

And then there might be some developments according to the client’s request.

That’s it.

(Stop laughing 😋). I studied all these php, php framworks, CMS, server configurations, database management and other few full stack stuffs using the internet only and doing these things for last 10 years.

Am I doing anything wrong? or is there a proper/best way to do these kind of operation?

Waiting for your kind and positive advices…

Cheers!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi there @THAS,

I personally believe that this is a quite good and solid setup.

Of course, there are other options out there as well, for example:

  • You could Dockerize your application and deploy separate containers for each client application, that way you will have a better separation between the applications.

  • Another option would be to use the new DigitalOcean app platform. That way you will be able to take advantage of features like vertical and horizontal scaling, push-to-deploy support, introspection and etc.

Regards,
Bobby

Hello @bobbyiliev,

**Thank you very much for your valuable response. That encourages me a lot!
**
Another thing I have to know is, if I give a unique subdomain and a unique port for each client,

IE: client1.mysite.com:9001 and client2.mysite.com:9002

Will this helpful to reduce server faults like bottleneck issues/performance issues when there is a heavy traffic.

Regards,
@THAS

  • Hi there @THAS,

    With Nginx, you will be able to set up reverse proxies for your subdomain names, so that if anyone visits client1.mysite.com in the background Nginx would proxy the traffic to your backend service running on port 9001 so that your clients will not have to enter the port in their browser.

    The main purpose of this setup is to allow you to host multiple applications on the same server so that you could fully utilize the server resources. However, this is not really intended to reduce bottlenecks, as all services will be running on 1 server.

    In case that you want to limit your customers, you could either host each customer on a separate Droplet. That way they would have dedicated resources and other applications will not affect each other.

    Another approach is to set different quotas for your Docker containers so that the containers are limited to a certain amount of hardware resources.

    Hope that this helps!
    Regards,
    Bobby