OK, this post is obviously another one of those posts for the more technically minded in the audience. Read on if interested ...
How to migrate a website to Ghost on EC2.
Using Bitnami deployment dashboard helped get the process started. Following are notes that helped get it all sorted.
- Follow the instruction on Bitnami to get the Ghost instance started on Amazon EC2.
- On Amazon EC2 dashboard allocate an elastic IP address to the new instance.
- Rename the instance to something meaningful e.g.
- SSH into the EC2 instance. This will require that you download key and connect to the new instance via SSH, use the bitnami console for instructions. Following is the format of the command
ssh -i [your-private-key].pem [email protected][replace-with-EC2-ip-address].
- Set certificate and DNS for the website following the instructions at https://docs.bitnami.com/aws/apps/ghost/administration/generate-configure-certificate-letsencrypt/
- Remove the Bitnami banner following the instructions at https://docs.bitnami.com/aws/how-to/bitnami-remove-banner/
- Change ghost url in configuration following the instructions at https://docs.bitnami.com/aws/apps/ghost/administration/configure-domain/
- When changing the ghost url also edit the
/opt/bitnami/apps/ghost/htdocs/config.production.jsonand ensure that the url is HTTPS without port :80 - if a change is required then restart ghost using instructions found here https://bitnami.com/stack/ghost/README.txt - hint use
sudo /opt/bitnami/ctlscript.sh restart ghost.
- If redirect loop to
127.0.0.1:2368following instructions here https://community.bitnami.com/t/how-to-get-https-working-80-redirect-loop-issues-resolved-ghost-gcp/55867 - in summary stop ghost then add
RequestHeader set X-Forwarded-Proto "https"to top of
- Make changes for Ghost email SMTP in configuration using the instructions found here https://docs.bitnami.com/aws/apps/ghost/configuration/configure-smtp/ - once again restart ghost as required.
Other useful links
- If migrating from another blog (e.g. WordPress) consider using Ghost migrate tool https://github.com/TryGhost/migrate - this tool will create a json file containing content and an assets folder with images to be copied into
- Backup considerations https://docs.bitnami.com/aws/apps/ghost/administration/backup-restore-mysql-mariadb/
- Upgrading Ghost https://docs.bitnami.com/installer/apps/ghost/administration/upgrade/
- Turning off pagespeed which can cause images not to appear because they are prefixed with the extension
- Connecting to mySQL https://docs.bitnami.com/bch/apps/ghost/get-started/connect-mysql/
- Organising a SSH tunnel (useful for connecting to mySQL on server) https://docs.bitnami.com/aws/faq/get-started/access-phpmyadmin/ along with https://linuxize.com/post/mysql-ssh-tunnel/ e.g. `ssh -N -L 3336:127.0.0.1:3306 -i pem-here [email protected]`
Feel very welcome to ask a question, or share a comment.