Install LAMP in Lightsail
This will install Mediawiki in Lightsail. I’m assuming you already setup SSH access.
Install LAMP
To speed up things with the rest of the software below, run this:
This is around 400Mb of software, but takes around four minutes to install.
Apache
Here I’m using the domain jano.com.es. You can use your own domain, static IP, or made-up domain if you add it to /etc/hosts.
Install Apache
Edit Apache configuration
Add this at the bottom
Check for errors and restart Apache
UFW
UFW is the Uncomplicated Firewall of Ubuntu. As the name suggests, it is easy to use.
Check that the UFW firewall has a profile for Apache
Check that the UFW firewall has an “Apache Full” profile that enables ports 80 and 443:
Only if you want to change the port from 80 to 90, you have to change the number in /etc/apache2/ports.conf
, and /etc/apache2/sites-enabled/000-default.conf
. Then you have to change the port to :90
Check that the Apache2 Ubuntu default page is accessible through your firewall at your server IP: http://jano.com.es
(use your domain or IP).
This should show the public machine IP but doesn’t. I guess the instance is in a container with its own gateway and network.
We can check the public IP on teh cosole, or just run:
Let’s Encrypt
If you have a domain and want to install a SSL certificate, Let’s Encrypt offers certificates for free. This will need port 80 access.
MySQL
Install MySQL:
Optionally run a script to secure MySQL:
PHP
Now installing PHP in Apache:
Tell Apache to serve index.php
before the default index.html
. Edit the /etc/apache2/mods-enabled/dir.conf
file and put the index.php
first.
Restart Apache:
Check the status of Apache. If you don’t see any errors it’s fine.
Check that PHP works. Create a php page:
with this content:
Load the page: http://jano.com.es/info.php
Now remove it to prevent intruders from gaining info about the server: