Nextcloud by docker-compose of nginx/php-fpm on AWS LightSail

Amazon Linux
Reading Time: 4 minutes

I run Nextcloud on Raspberry Pi 4.

In this article I have set up Nextcloud on AWS LightSail.

I found these benefits.

- Rich CPU power (compared to Raspberry Pi
- Easy set up because of cloud computing
- First 3 month free
- Cheap monthly fee (10USD)

On the other hand there is some cons.

- We need to pay monthly
- Not much storage capacity

This may be good if you don’t need much storage capacity.
– My case needs more than 100 GB due to tons of photos/videos…

Let’s do it.

First step is to get your original domain name.
Please refer this article.
If you don’t disclose to public then free domain provider can be used like Freenom.

Next is to create LightSail instance from LightSail top page.

Choose Create Instance.

Instance can be LInux/Unix.

OS Only -> Amazon Linux 2.

Choose 10USD.
First 3 months free!

This is why I choose 10USD instance.

- 3.5USD cannot run Nextcloud because 512MB RAM.
- There is only 100MB free if we run Nextcloud on 1GB instance.

Create Instance with your instance name.

After some time instance will be created.

Let’s assign static IP address.
Go to Networking.

Create static IP.

Input name and Create.

Register your domain name to LightSail DNS.
There is example.
original domain name and domain name with prefix “www” are registered.
AAAA record is for IPv6 of A record.

Go to console of instance.
I referred docker official site to know how to install docker-compose.

# Install mandatory application
sudo yum install docker git

# Install docker-compose
curl -SL -o docker-compose
sudo cp docker-compose /usr/libexec/docker/cli-plugins/
sudo chmod +x /usr/libexec/docker/cli-plugins/docker-compose

Create container.

# Reverse proxy
git clone
# Nextcloud
git clone

I modified these parts.

- Changed base image of db
  jsurf/rpi-mariadb:latest -> mysql:latest
- Set 24.0.2 to NEXTCLOUD_VER on .env file
- Deleted collabora container
- Updated URL in nginx/conf.d/default.conf
  richdocumentscode_arm64 -> richdocumentscode

You can run Nextcloud after running some command.
Please modify docker-compose.yml in reverse-proxy.

# Reverse proxy
cd reverse-proxy
sudo docker compose up -d

# Nextcloud
cd $HOME/nextcloud-container-fpm
sudo docker compose build
sudo docker compose up -d

If all are fine then you should be able to see Nextcloud initial setup page.

Please add these parts in config.php.

$CONFIG = array (
  'overwrite.cli.url' => '',
  'overwriteprotocol' => 'https',
  'trusted_domains' => 
  array (
    0 => '',
    1 => '',

This is my configuration.

In this screen we are recommended to install Collabora Online – Built-in CODE Server.
But in my case many timeout occurs after installation.

So I didn’t install.

If everything goes fine then setup will be done!

This is htop.
RAM is used more than expected.


How was it?

This is your own storage, it’s good!