Deployment on SiteGround

I’m stuck trying to deploy Frontity to my server on SiteGround.

Setting up frontity locally took me less than 10 minutes awesome :slight_smile:
After another ten minutes customizing the end-points, connecting it with my own (twanneman.nl) wordpress site, I’m up and running locally.

Now I want to deploy the app so after reading this article I’ve managed to get node & npm running on my (shared) Siteground hosting environment. After that I’ve setup a subdomain at https://frontity.twanneman.nl/

I’m not sure what to copy, so I copied the entire build directory, is that the correct way?
But… when I goto https://frontity.twanneman.nl/server.js I get script output.

Also… should I install frontity on the hosting environment? Any help would be greatly appreciated!

1 Like

Awesome :relaxed:

You can start Frontity as a node app with

npx frontity build && npx frontity serve

but that starts a local server (localhost:3000).

When using node, you usually need to set up your Apache or Nginx as a reverse proxy in front of node. I have no idea of how to set up Apache or Nginx in SiteGround right now but we have some friends there so I’m going to ask :slight_smile:

In the future we’ll release guides to deploy Frontity in different hostings like SiteGround.


In the meantime my recommendation is to use Now where you don’t need to set up Nginx or Apache. The free plan should be more than enough to get you started and you can move back to SiteGround later one.

You don’t need to move your WordPress installation, this is only for Frontity.

We will release a deploy guide to Now the next week with detailed info but if you want to go ahead:

  1. Install the now package in your project:
npm install --save-dev now
  1. Add this now.json file:
{
  "version": 2,
  "alias": ["frontity.twanneman.nl"],
  "builds": [
    {
      "src": "package.json",
      "use": "@now/static-build",
      "config": { "distDir": "build" }
    },
    {
      "src": "build/server.js",
      "use": "@now/node"
    }
  ],
  "routes": [
    {
      "src": "/static/(.*)",
      "headers": {
        "cache-control": "max-age=31536000,s-maxage=31536000,immutable"
      },
      "dest": "/static/$1"
    },
    { "src": "/favicon.ico", "dest": "/favicon.ico" },
    {
      "src": "/(.*)",
      "headers": { "cache-control": "s-maxage=1,stale-while-revalidate" },
      "dest": "/build/server.js"
    }
  ]
}
  1. Add a CNAME of frontity.twanneman.nl to alias.zeit.co in your domain DNS settings.
  2. Deploy Frontity using this command
npx frontity build && npx now --target production

If you have any problem let us know :slight_smile:

hey

npm install --save-dev now

This is tripping my antivirus. It downloads a file called “now.exe”. Should I be worried or is it just a false positive?

Zeit is a legit company but if you want to contact them you can do so at their spectrum channel https://spectrum.chat/zeit (which is official: https://zeit.co/chat).

I’d bet that the now.exe file is the binary file of zeit/now-cli after being packaged with zeit/pkg