How Can We Help?
< All Topics
Print

Running Multiple Domain Names on Apache Server

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. FYI, the words that make up a domain name 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 online brand. But that is not the only advantage of using multiple domains:

  • Gives you the ability to increase usability
  • Efficiency and scalability of your PHP application
  • Reduces your costs without having to set up separate instances

So, let’s see how to run multiple domains on an Apache application server to make your PHP application even more scalable and effective. 

1.  Log in to BitssCloud dashboard.

2.  Click Create an environment at the top left corner of the dashboard.

3. In the opened wizard navigate to PHP tab, pick the application server and specify the number of resources your application needs. After that enter the name for the environment and click Create button.           

4.  In some seconds your environment will appear on the BitssCloud dashboard. 

5.  You need to have 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 records or by setting A Records. 6. After that click the Settings button for your environment and bind your domains.  As an example, we use the following URLs: mydomain.com and myseconddomain.com.

Note: In this case, we put entries in our host’s file for local testing and it will work only from the machine with those hosts entries.

7. Now you can upload zip packages with your apps to the Deployment manager and deploy them to the environment you’ve created earlier.    

8. Once your applications are successfully deployed click the Config button for Apache and navigate to the httpd.conf file (conf directory) to specify your virtual host configurations

Listen 80
<VirtualHost *:80> 
DocumentRoot /var/www/webroot/ROOT 
ServerName mydomain.com
...
</VirtualHost>
<VirtualHost *:80> 
DocumentRoot /var/www/webroot/ROOT-218    
ServerName myseconddomain.com    
...
</VirtualHost>

9. Save the changes and restart Apache in order to apply the new settings.

 

10. Now you can check the results to ensure that everything works properly.

Table of Contents