Search code examples
phpmysqlhost

how is it possible to connect all domains to this single hosting?


I am trying to make a hospital management system in php, so that atleast 4 hospitals are going to use it, and every hospital needs a special domain to login to the system. My question is how can i manage all these domains and databases to use one single host and also how can i send notifications if there is an update to the system.


Solution

  • Your question needs a little more details, but in general this is how it works.

    1. I assume your a sys admin, and you will work on a Linux system, using apache.

    2. You need to create users in the server, or at least different directories for all your websites, usually they will be under /www/{name of the site}/*

    3. You will need a DB per each customer

    4. You need to define if they will access only with different domain name or also in different tcp ports, usually multi-web-hosting happens all in port 80 or 443.

    5. Read about Virtual hosts in apache, because the magic will happen there. https://httpd.apache.org/docs/2.4/vhosts/examples.html

    This is how a single block will look like.

    <VirtualHost 172.20.30.40:8080>
        DocumentRoot "/www/example1-8080"
        ServerName www.example.com
    </VirtualHost>
    
    1. DNS, depending on how you are going to test, you need to modify the DNS records, if you are testing locally, you can modify your hosts, this will anyways redirect the traffic to the IP that you need, apache will take care of the rest.

    *Forgot about the notifications, this depends a lot of your infrastructure, you can use emails, for that you need to configure sendmail or your favorite email server, you can also use push notifications if you have the web infrastructure to do so, etc.