Running Multiple Domain Names on a PHP Server
Leveraging multiple domains can significantly enhance the usability, efficiency, and scalability of your PHP application while also optimizing costs by eliminating the need for separate instances.
Let’s delve into the process of running multiple domains on a PHP application server to amplify the scalability and effectiveness of your PHP application.
Step 1. Access your Accuweb.Cloud account by logging in with your credentials.
Step 2. Navigate to the top left corner of the dashboard and click on “Create Environment.”
Step 3. Within the opened wizard, proceed to the PHP tab. Select the desired application server and specify the required number of resources for your application. Subsequently, provide a name for the environment and click on the “Create” button to initiate the process.
Your environment will be visible on the platform dashboard within a few moments.
Step 4. To ensure your environment’s services are accessible by name on the internet, you’ll need to register domain names and configure them to point to your IP address. This can be achieved in two main ways:
- CNAME Records: This method redirects a subdomain (e.g., “www”) to an existing domain name.
- A Records: This method directly associates a domain name with your IP address.
Step 5. Following domain acquisition, proceed to click on the “Settings” button for your environment. Then, bind your domains by associating them with your environment. For demonstration purposes, we will use the URLs: mydomain.com and myseconddomain.com.
Step 6. You can now upload zip packages containing your applications to the Deployment Manager and deploy them to the environment you created earlier.
Once your applications are deployed successfully, you must specify your virtual host configurations.
For Apache
Click on the “Config” button next to the Apache server, then open the httpd.conf file located in the conf directory.
Set the VirtualHost parameters for the two domain names separately by specifying the paths to the deployed contexts and the domain names.
Listen 80
<VirtualHost *:80>
    DocumentRoot /var/www/webroot/firstapp
    ServerName mydomain.com
    ...
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /var/www/webroot/secondapp
    ServerName myseconddomain.com
    ...
</VirtualHost>
Be sure to save the changes and restart the application server to apply the new settings.
With NGINX, there’s no need to define separate server blocks or virtual host configurations for each domain you connect/bind.
You can now verify the results to confirm that everything is functioning correctly.
This guide takes the complexity out of managing multiple websites! By leveraging Accuweb.Cloud’s platform, you can run several websites under a single, powerful PHP application server. This not only saves you money compared to separate servers, but it also makes things easier to manage.
Imagine offering distinct experiences for different audiences all from one central location – that’s the power of this approach. Plus, Accuweb.Cloud streamlines the process of connecting your domain names, deploying your websites, and configuring everything so it runs smoothly.
So ditch the multi-server headaches and embrace the efficiency of running multiple websites under one roof!






