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
Today we will show you how to run multiple domains on an Apache application 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 the PHP tab, select Apache as your application server and specify the number of resources your application needs. After that, enter your environment name and click Create
Your environment will appear on the Jelastic dashboard momentarily.
3. You need to have the names set in your DNS, resolving to your IP address. It can be done in two ways: by adding a CNAME record or by setting A Records. Read more here
4. Next, click the Settings button for the environment you have created earlier and bind your domains. In this case we will use these URLs: mydomain.com and myseconddomain.com.
Note: In this case we put entries in our host’s file for local testing and this will work only from the machine with those host entries.
5. Now you can upload zip packages with your apps to the Deployment manager and deploy them to the environment you created earlier.
6. 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 /firstapp ServerName mydomain.com ... </VirtualHost> <VirtualHost *:80> DocumentRoot /secondapp ServerName myseconddomain.com ... </VirtualHost>
7. Save the changes and restart Apache in order to apply the new settings.
8. Now you can check the results to ensure that everything works properly.
We hope that you have found this tutorial useful. Domain names are crucial to your online identity so don’t forget to protect them. With Jelastic, it only takes a few minutes. Enjoy!