Of course your PHP website domain name is a front-page online property. Your customers use it to access your site and it’s closely connected with your site’s brand. BTW the words that make up a domain names are used by search engines to evaluate websites in search results.
It is a good idea to register multiple domain names that are similar to your website’s main domain name to protect your website’s online brand. But it’s not the only advantage of using multiple domains, it gives you the ability to increase the usability, efficiency and scalability of your PHP application and of course to save your costs without having to set up separate instances.
So, let’s consider how to run multiple domains on Apache server to make your PHP application even more scalable and effective.
1. Log into your Jelastic account and click Create environment.
2. In the appeared window navigate to PHP tab, pick Apache server and specify the number of resources your application needs. After that enter your environment name and click Create.
In some seconds your environment will appear on the Jelastic dashboard.
3. You need tohave the names in DNS, resolving to your IP address. So, buy domain names for your environment. It can be done in two ways: by adding CNAME record or by setting A Records. Read more here
4. Then click the Settings button for the environment you have created earlier and bind your domains. In this case we use the next URLs: mydomain.com and myseconddomain.com.
Note: In this casewe put entries in our hosts file for local testing and this will work only from the machine with those hosts entries.
5. Now you can upload zip packages with your apps to the Deployment manager and deploy them to the environment you’ve created earlier.
6. Once your applications are successfully deployed click Config button for Apache server and navigate to the httpd.conf file (conf directory) to specify your virtual host configurations:
Listen 80 <VirtualHost *:80> DocumentRoot /firstapp ServerName mydomain.com ... </VirtualHost> <VirtualHost *:80> DocumentRoot /secondapp ServerName myseconddomain.com ... </VirtualHost>
7. Save the changes and restart Apache in order to apply new settings.
8. Now you can check the results to ensure the all works properly.
Hope this stuff will be useful for you. Domain names are very crucial pieces of your online identity so don’t forget to protect them. With Jelastic it’s only few minutes. Enjoy!