0

We have a SaaS product and we give websites for customers. The customers can request to have their own domain pointed to their website. At the moment we use httpd.conf file to add a VirtualHost entry pointing to the same document directory. Afterwards the database will load the website by matching the URL. We have CentOS installed.

I think this is quite risky because if there is a mistake in httpd.conf file their is potential the whole product might not work. This has actually happen. Also, we use WHM and cPanel, so when we add a mod or does a server tweak the entire httpd.conf gets rewritten having us to replace/add existing virtual host entries to the file.

I will need a solution where i can add VirtualHost entries in a separate conf file or multiple conf files and load them via httpd.conf file which should automatically pick the newly added file/files without having to restart the server.

Can someone point me in the right direction where i can achieve the above.

Cheers!

Pavan Welihinda
  • 605
  • 3
  • 11
  • 26
  • I am assuming that your server is not running a Debian GNU/Linux related ditro, because in them apache is configured in the exact same way you are describing: each VirtualHost has its own config file, which you can enable/disable. Check [this](https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts#step-four-—-create-new-virtual-host-files) – gmc Mar 18 '17 at 09:40
  • We have CentOS installed. I have updated this in the question as well. So far all our custom domain sites are listed in httpd conf file. So i need to try creating a conf file within sites_available and then restart the server each and every time? I dont see this as a scalable solution. – Pavan Welihinda Mar 18 '17 at 10:41

1 Answers1

0

You dont need to restart, just reload

gmc
  • 3,910
  • 2
  • 31
  • 44
  • Yes, we are using CentOS so /etc/apache2/sites-available directory is not available. – Pavan Welihinda Mar 18 '17 at 12:31
  • Ok strangely in our QA server, i didnt have to add any virtualhost configurations, as soon as the domain was pointed, the website was loaded. I released the virtualhost configurations were only needed in the live server. Both have Apache 2.4. Is there a reason behind this? Im sure this has something to do with a configuration change. – Pavan Welihinda Mar 18 '17 at 15:14