Ghost installation - too many redirections

Issues when setting up Ghost on AWS.

Here I'm hosting my website on AWS, where the Ghost package is managed by bitnami. After I installed Ghost on AWS following the official setup (see here), I met the following issues:

The first one is that view site that refused to connect. According to the Internet, this is because the view site window is directing to "http://yourwebsite.com/ghost/#/site". But, after having configured Https, the view site should direct to "https://...". This can be fixed by using the following code:

ghost config url https://yourwebsite.com

However, this will cause the website fail to be loaded due to redirecting too many times. This can be fixed by going to

cd /opt/bitnami/apache2/conf/vhosts

and find the file ghost-https-vhost.conf. Open the file and add RequestHeader set X-Forwarded-Proto "https" like the following way

<VirtualHost 127.0.0.1:443 _default_:443>
    RequestHeader set X-Forwarded-Proto "https"
    ServerName www.example.com
    ServerAlias *
    ...

Restart Ghost and apache by using

sudo /opt/bitnami/ctlscript.sh restart ghost
sudo /opt/bitnami/ctlscript.sh restart apache

and the problem is fixed.