I know the question is bit weird. Accessing apache files using PHP. But I don't know any other ways and open for any other solution. Below I explained what I am trying to do.

I am making prototype model for SaaS for multiple portals. Customers of PORTAL 1 just need to point their A record to given IP address to use PORTAL 1. PORTAL 1 app is hosted at /var/www/html.

Portal 2 app is hosted at /var/www/html/portal2. So now I want client domains of PORTAL 2 to be pointed to /var/www/html/portal2. One way is that I ask client to point A record to same IP address same like portal1 and then add vhost records manually for each domain to point to /var/www/html/portal2. But that is manual process. I need to automate this through cron job where PHP script checks for if any domain is registered for portal 2 or not and if yes it adds a record to host directory.

OS: Ubuntu 18.04 PHP 7.2

Currently I am editing /etc/apache2/sites-available/000-default.conf to make it work. Is there a way to automate this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.