In this tutorial we’ll show you how to host a PHP website and run multiple custom domains on an NGINX web server in minutes. You can greatly benefit from the features of having multiple domain names. This helps with SEO and is a great benefit for your website security and anonymity. Cost spending is also decreased because you only pay for one service for two or more of your domains.
Do you have multiple custom domain names and want one of the domains to point to the main page of your PHP website, but the other domains to point to a subsection of your site without modifying the URL in the address bar? No problem! With Jelastic PaaS you can achieve all these actions right in the cloud in just a few minutes!
1. Sign up and log into your Jelastic account.
2. Click the Create environment button and select the PHP tab in order to create a new environment for your PHP application. After that choose NGINXweb server and specify the resource usage limits for it (reserved and dynamic values). Configure your environment topology by picking other software stacks, which are needed for your PHP application proper functionality. Then enter your PHP environment name and click on the Create button.
In a few seconds your environment with NGINX web server will be successfully created.
3. Youhave to set your domain names in your DNS, resolving to your environment IP address, for further binding to the created environment. You can do this in two ways: by adding a CNAME record or by setting A Records. Find more information here.
4. After you have your own domain names, go back to the Jelastic dashboard and click the Settings button for your environment. Navigate to the Custom domains tab and bind your domain names.
Note: We didn’t buy real domain names, we’ve just put entries into a hosts’ file for local testing and this works only for the machine with these host entries.
5. Upload your zip packages to the Deployment manager and deploy them to different contexts.
6. Once your applications are deployed to the specified contexts click Config for NGINX and navigate to the nginx.conf file, which is located in the conf directory. Specify your settings in the server block by following the next example:
7. Save the changes, restart the NGINX server and check the results.
Now that was easy and fast! Registration of multiple custom domains is a very easy and inexpensive task. Now, binding and running on an NGINX web server becomes much easier too. Benefit from all of the advantages of having multiple domain names, with Jelastic.