Using multiple domains provides you with ability to increase the usability, efficiency and scalability of your PHP application and of course saves your money without necessity to set up separate instances.
So, let’s see how to run multiple domains on PHP application server to make your PHP application even more scalable and effective.
1. Log in to Edge Cloud PaaS Portal.
2. Click Create environment at the top left corner of the dashboard.
3. In the opened wizard navigate to PHP tab, pick application server and specify the number of resources your application needs. After that enter the name for environment and click Create button.
After few minutes your environment will appear on the dashboard.
4. 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 record or by setting A Records. You can read more here.
5. 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.
6. Now you can upload zip packages with your apps to the Deployment manager and deploy them to the environment you’ve created earlier.
7. Once your applications are successfully deployed you need to specify your virtual host configurations.
- for Apache
Click Config button next to the Apache server and open the httpd.conf file (in conf directory). Set VirtualHost parameters for two domain names separately by specifying the paths to the deployed contexts and the names of domains:
- for NGINX
Click Config button next to the NGINX server and open the nginx.conf file in the conf directory.
Specify your settings in the server block
- server_name (your domain)
- ROOT (the context you stated while deploying)
Note that you need to have a separate server block with its own settings for each domain which you bind.
In our case the settings will be following:
8. Don’t forget to Save the changes and Restart application server in order to apply new settings.
9. Now you can check the results to ensure that all works properly.
Hope this instruction will be useful for you. Domain names are very crucial pieces of your online identity so don’t forget to protect them. With Edge Cloud PaaS it takes just a few minutes. Enjoy!
Edge Cloud PaaS provides 14 Days FREE TRIAL for all developers and customers with no obligations or whatsoever.
For any enquiries, you can reach EDGE CLOUD via email at email@example.com or visit www.edgecloud.com.ph for additional information.