Moved this website from bitnami to nginx/php-fpm/mariadb

Amazon Linux

Reading Time: 2 minutes

This website was made on 2020 November and running on bitnami on LightSail.

Recently I got this warning.
– PHP update recommended
– Your PHP is 7.3.18 which is old version



I agree old PHP isn’t good because of security reason.
I updated to the latest PHP version.

This is current PHP version of this website.

sudo docker compose exec wordpress php -v
PHP 8.1.10 (cli) (built: Sep 13 2022 10:34:13) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.10, Copyright (c), by Zend Technologies



This is what I did, which are not complicated.

- Creating new LightSail instance which is Amazon Linux 2
- Backing up bitnami
 * Web contents
 * Database
- Restoring backup to Amazon Linux 2 instance
- Switching DNS configuration to reply Amazon Linux 2's IP address
- Stopping bitnami instance

 

Creating new LightSail instance which is Amazon Linux 2

I referred this article.

I assgined static IP address to new instance as well.

Backing up bitnami and restoring to Amazon Linux 2

You can refer this article.



You don’t have time?
Yes, you can take these scripts!

# Web contents
cd /opt/bitnami/apps/wordpress/htdocs/
sudo tar jcf wordpress.tar.bz2 .
# Database
mysqldump -u root --single-transaction -p bitnami_wordpress > bitnami_wordpress.linuxfun.org.sql

This is how to restore.

# Web contents
cd html
sudo tar jxf wordpress.tar.bz2 .
sudo chown -R www-data:www-data .
# Database
sudo cp bitnami_wordpress.linuxfun.org.sql mysql
sudo docker-compose exec db /bin/bash
# Below is work in container
sed -i 's/utf8mb4_unicode_ci/utf8mb4_unicode_ci/g' /var/lib/mysql/bitnami_wordpress.linuxfun.org.sql
mysql -u root -p bitnami_wordpress < /var/lib/mysql/bitnami_wordpress.linuxfun.org.sql

Switching DNS configuration to reply Amazon Linux 2’s IP address

This step depends on which DNS server you are using.
In my case I use Google Domains, which forwards query to DNS server of LightSail.

My case is very easy because I only need to configure DNS configuration of LightSail.

Stopping bitnami instance

You can stop as usual.

Conclusion

How was it?

I feel bitnami is a bit blackbox and is difficult to look into detail.
From now I can easily maintain!

Comments

Copied title and URL