Overview

I had the opportunity to run Strapi on Amazon Lightsail, so this is a personal note. I referenced the following article.

https://zenn.dev/holykzm/articles/1e54cc25207657

Instance

Select Node.js.

Please select one with 1GB or more of memory. If you build on Lightsail, an out-of-memory error will occur.

SSL, Custom Domain

Please refer to the following.

/en/posts/5772d6c918508a/#独自ドメインの付与

Assign a Static IP, set up a custom domain with Route 53, and execute the following.

sudoopt/bitnami/bncert-tool

ProxyPass Configuration

(There may be a more appropriate location for this, but) add the following.

#PPrrooxxyyPPaassssR/evhetrtspe:/lhotctapl:h/slto:c1a3l3h7st:1337/

Restart Apache.

sudoopt/bitnami/ctlscript.shrestartapache

Installing Strapi

cndpxocprte/abtiet-nsatmria/paip-aacphpe@2l/ahttedsotcsb/ackend-quickstart

The app will start, so stop it temporarily with Ctrl+C or similar.

pm2

Installing pm2

sudonpminstallpm2-g

Creating server.js

cvdisoeprt/ebri.tjnsami/apache2/htdocs/backend
conssttrsatpria(p/i*={.r.e.q}uire(.'s@tsatrrta(p)i;/strapi');

Build

cNdODEo_pEtN/Vb=iptrnoadmuic/taipoanchnep2m/hrtudnocbsu/ibladckend

Starting the Server

NODE_ENV=productionpm2startserver.js-namestrapi

Strapi was successfully started as shown below.

Other

  • To stop the service
pm2stopstrapi
  • To edit content types

You need to start in development mode, so execute the following.

#PPrrooxxyyPPaassssR/evhetrtspe:/lhotctapl:h/slto:c1a3l3h7st:1337/

0

After editing is complete, run the build and pm2 startup again.

#PPrrooxxyyPPaassssR/evhetrtspe:/lhotctapl:h/slto:c1a3l3h7st:1337/

1

Summary

This time I switched between development and production modes on Lightsail, but as described in the following article, there also seems to be a method using GitHub Actions, which I would like to try in the future.

https://datasciencedude.com/how-to-deploy-strapi-to-aws-lightsail-with-github-actions