How to Run Gatsby on Cloudways?

9 minutes read

To run Gatsby on Cloudways, you need to follow a few steps:

  1. Sign up for a Cloudways account and log in to your dashboard.
  2. Launch a new server by selecting your preferred cloud provider, server size, and location.
  3. Once your server is ready, click on the 'Applications' tab and then 'Add Application.'
  4. Fill in the necessary details for your Gatsby application, such as the name, folder name, and domain.
  5. Select the appropriate stack and version for your application, which should include Node.js.
  6. Choose one of the pre-installed Git providers or manually provide your Git repository URL.
  7. Once you've added your application, click on it from the 'Applications' tab to access the details page.
  8. Under the 'Access Details' section, you'll find your server information, such as IP address, username, and password. You can use these details to connect to your server via SSH.
  9. Connect to your server using an SSH client like PuTTY (Windows) or Terminal (Mac/Linux) and navigate to the application folder.
  10. Install Gatsby globally on your server by running the command: npm install -g gatsby-cli
  11. Clone your Gatsby repository on the server using the command: git clone
  12. Navigate to the cloned repository folder and install the project dependencies by running: npm install
  13. Once the dependencies are installed, build your Gatsby project by running: gatsby build
  14. After the build process is complete, you can start your Gatsby application by running: gatsby develop
  15. Your Gatsby application should now be accessible via the assigned domain or IP address.

By following these steps, you can successfully run a Gatsby application on Cloudways.

Best Cloud Hosting Providers in 2024


Rating is 5 out of 5



Rating is 4.9 out of 5



Rating is 4.8 out of 5



Rating is 4.7 out of 5


How to enable automatic deployment of Gatsby sites on Cloudways?

To enable automatic deployment of Gatsby sites on Cloudways, follow these steps:

  1. Log in to your Cloudways account and select the desired server/application on which you want to deploy the Gatsby site.
  2. Go to the "Deployment via Git" section from the left side menu.
  3. Click on the "Connect to Git Repository" button.
  4. Select the repository provider (e.g., Github, Gitlab, Bitbucket) from the list, and authorize Cloudways to access your repositories if required.
  5. Choose the repository and branch that contains your Gatsby site's code.
  6. Enter the appropriate deployment path, domain, application and environment settings. You can configure advanced options such as automatic deployments on push and branch filtering, depending on your needs.
  7. Once you've completed the configuration, click on the "Connect Application" button.
  8. Cloudways will fetch your Gatsby site's code and deploy it to the server.
  9. You can monitor the deployment progress in the "Deployment" tab. Once the deployment is finished, you'll receive a notification.
  10. Your Gatsby site is now deployed and ready to be accessed via the specified domain.

By enabling automatic deployment, Cloudways will automatically update your Gatsby site whenever you push changes to the connected repository, ensuring that your site is always up to date.

What is the process of deploying a Gatsby site on Cloudways?

To deploy a Gatsby site on Cloudways, follow these steps:

  1. Sign up for an account on Cloudways if you haven't already.
  2. Create a new server on Cloudways by selecting your preferred cloud provider, server size, and location.
  3. After the server is created, go to the Application Management tab and click on "Add Application."
  4. Select the desired server and enter a name for your application.
  5. Choose the PHP stack and version that matches your Gatsby site's requirements. Gatsby is built on Node.js, but Cloudways supports running Gatsby as a PHP application.
  6. Once the application is created, under the Application Management tab, click on the application you just created.
  7. Navigate to the "Access Details" section and note down the URL, username, and password for your application. These details will be required to access your deployed Gatsby site.
  8. Connect to the server via SSH using your preferred SSH client, or you can use the Cloudways console access.
  9. Once connected to the server, navigate to the document root directory of your application by running the following command: cd applications/[your_application_name]/public_html
  10. Remove the existing files and folders within the public_html directory by running: rm -rf *
  11. Clone your Gatsby site repository by running the following command: git clone [your_gatsby_repository_url] .
  12. Install all the dependencies required by your Gatsby site by running: npm install
  13. Build your Gatsby site by running: npm run build
  14. Once the build process is complete, your Gatsby site is ready to be accessed. Open a web browser and enter the URL noted earlier in Step 7 to view your deployed Gatsby site.

Note: Remember to configure your DNS settings, such as adding a domain name or setting up SSL, if necessary, to ensure your Gatsby site is accessible using your desired domain.

How to install Gatsby on Cloudways?

To install Gatsby on Cloudways, you can follow these steps:

  1. Create a new Cloudways account or log in to your existing account.
  2. Once logged in, click on the "Launch" button to create a new server.
  3. Select the desired server location, cloud provider, and server size. You can choose any provider that supports Node.js.
  4. Choose an application name and deploy method. Select "Custom Application" for greater flexibility.
  5. In the next step, select the server and application details. Choose the PHP version as 7.x or higher.
  6. Click on the "Launch Now" button to create the server.
  7. After the server is successfully created, go to the "Applications" tab from the top menu.
  8. Click on the "Install App" button and choose "Node.js" from the dropdown menu.
  9. In the installation settings, set the "Node.js Version" to the latest stable version.
  10. In the "Node.js Package" field, enter "gatsby" and click on the "Install" button.
  11. Once the installation is completed, go to the "Access Details" tab and you will find the application URL.
  12. To start using Gatsby, you need to clone your Gatsby project repository to the server via SSH or SFTP.
  13. Once your code is deployed, open the terminal from the Cloudways platform or use an SSH client like Putty to access the server.
  14. Navigate to your project root folder and run the following command to install the project dependencies:
npm install

  1. After the dependencies are installed, you can start the Gatsby development server with the following command:
npm run develop

  1. Your Gatsby website should now be available at the URL provided in the "Access Details" tab. You can continue building and customizing your Gatsby project.

That's it! You have successfully installed Gatsby on Cloudways and can now begin building your dynamic website.

How to update Gatsby to the latest version on Cloudways?

To update Gatsby to the latest version on Cloudways, you can follow these steps:

  1. Log in to your Cloudways account and go to the "Applications" tab.
  2. Select the Gatsby application you want to update.
  3. Click on the "Application Management" tab.
  4. In the "Webroot" field, make sure the path to your Gatsby project is correct.
  5. Scroll down and click on the "Clear Cache" button to clear any cached files.
  6. Next, click on the "Settings & Packages" tab.
  7. Scroll down to the "Packages" section and click on the "npm" button.
  8. In the "Scripts/Commands" field, enter "update gatsby" (without quotes) to update Gatsby.
  9. Click on the "Save Changes" button.
  10. Finally, go to the "Deployment" tab, select your deployment method (Git, SSH/SFTP, or Cloudways Git), and follow the necessary steps to deploy your updated Gatsby site.

Note: Make sure you have a backup of your Gatsby project before updating to the latest version in case any issues arise during the update process.

What is the process of configuring cache headers for a Gatsby site on Cloudways?

To configure cache headers for a Gatsby site on Cloudways, you will need to follow these steps:

  1. Log in to your Cloudways account and select the desired server and application where your Gatsby site is hosted.
  2. Go to the "Application Management" tab and click on "Settings & Packages".
  3. Under the "General Settings" section, click on the "Varnish Settings" button.
  4. In the Varnish Settings, you will see a field labeled "Custom Varnish Configuration". Here, you can add custom VCL (Varnish Configuration Language) code to configure cache headers.
  5. To configure cache headers, you can add the following code in the custom VCL configuration field:
sub vcl_backend_response {
  set beresp.ttl = 24h; // Cache response for 24 hours
  set beresp.http.Cache-Control = "public, s-maxage=3600, max-age=3600"; // Set Cache-Control header for 1 hour
  set beresp.http.X-Proxy-Cache = "HIT"; // Display HIT in the response header for cached responses

sub vcl_deliver {
  if (obj.hits > 0) { // Display HIT in the response header for cached responses
    set resp.http.X-Proxy-Cache = "HIT";

  1. Click on the "Save" button to apply the changes.

With the above configuration, you have set the cache expiration time to 1 hour (s-maxage and max-age), which means the content will be cached for that duration. Additionally, the "X-Proxy-Cache" header will display "HIT" for cached responses.

Remember to adjust the cache settings according to your specific requirements and Gatsby site's needs.

Please note that enabling Varnish cache affects dynamic content. So, if your Gatsby site has dynamic content, make sure to handle cache exclusion for such content to avoid serving outdated data.

Facebook Twitter LinkedIn Telegram

Related Posts:

To run Gatsby on cloud hosting, you can follow these steps:Choose a cloud hosting provider: Select a cloud hosting provider that supports serverless functions or static site hosting. Popular options include AWS Amplify, Netlify, or Vercel. Set up your Gatsby p...
Deploying Gatsby on GoDaddy is a straightforward process that involves a few steps. Here's a brief overview:Build your Gatsby site: Use the Gatsby CLI to create and develop your website. Write your code, add plugins, and customize it as per your requiremen...
To install WooCommerce on Cloudways, follow these steps:Log in to your Cloudways account.On the Cloudways console, click on the "Applications" tab.Next, click on "Add Application" and choose the PHP version and server of your preference.Enter a...