Deploying a Node.js project on a subdomain with Bitbucket in shared hosting can be a bit challenging, but with the right steps, it can be done smoothly. In this tutorial, we will guide you through the process of deploying your Node.js project on a subdomain using Bitbucket and shared hosting.

Step 1: Set up a Subdomain

The first step is to set up a subdomain on your shared hosting account. Log in to your hosting control panel and navigate to the DNS management section. Create a new subdomain and point it to the desired directory where you want to deploy your Node.js project.

Step 2: Configure Bitbucket

Next, you need to configure Bitbucket to deploy your project to the subdomain. Create a new repository on Bitbucket and push your Node.js project to it. In the repository settings, go to the ‘Pipelines’ section and enable pipelines for the repository.

Step 3: Create a Bitbucket Pipeline

To deploy your project automatically whenever you push changes to the repository, you need to create a Bitbucket pipeline. In the root directory of your project, create a file named ‘bitbucket-pipelines.yml’ and configure it with the necessary deployment steps.

Step 4: Add Environment Variables

If your Node.js project requires any environment variables, make sure to add them to the pipeline settings on Bitbucket. This will allow your project to access the required variables during deployment.

Step 5: Test the Deployment

Once you have set up the pipeline and added the necessary configuration, it’s time to test the deployment. Make a small change to your project code, commit and push it to the Bitbucket repository. Bitbucket will automatically trigger the pipeline, and you can monitor the deployment process from the Pipelines section.

Step 6: Verify the Subdomain

After the deployment is complete, you should verify that your Node.js project is running on the subdomain. Open a web browser and enter the subdomain URL. If everything is set up correctly, you should see your Node.js application running on the subdomain.

That’s it! You have successfully deployed your Node.js project on a subdomain with Bitbucket in shared hosting. Now you can make further changes to your project code and push them to the repository to trigger automatic deployments.

Leave A Comment