To quickly deploy Node.js on Cloudways, follow these steps:
- Sign in to your Cloudways account or create a new one if you haven't already.
- Once you're logged in, click on the "Launch" button to set up a new server.
- Choose your desired cloud provider (DigitalOcean, AWS, Google Cloud, Linode, or Vultr), preferred server size, and location.
- Select the Ubuntu operating system and the latest version of PHP as your application.
- Scroll down and enable the "Managed Databases" option if you want to integrate a managed database with your Node.js app. Otherwise, you can skip this step and set up your database manually later.
- Click on the "Launch Now" button to create your server.
- Once your server is up and running, click on it in the Cloudways dashboard to access the server management area.
- Navigate to the "Applications" tab and click on the "+ Create Application" button.
- Choose the "NodeJS" option from the available list of applications.
- Provide a name for your application, select the desired number of instances (servers), and specify the desired node version.
- Click on the "Add Application" button to create your Node.js application.
- Once the application is created, you will see a URL under the "Access Details" column. This is the URL of your deployed Node.js app.
- To deploy your Node.js code, you have multiple options. One option is to use the built-in SSH terminal provided by Cloudways. You can access it by clicking on the server name and then on the "Launch SSH Terminal" button.
- In the SSH terminal, navigate to the application's directory using the cd command and then upload your Node.js code using Git or any other method you prefer.
- After uploading your code, you can install the required dependencies by running npm install.
- Finally, start your Node.js app by running npm start or the appropriate command specified in your package.json file.
That's it! Your Node.js app is now deployed and running on Cloudways. You can access it using the URL provided in the Cloudways dashboard.