1. Setup Digital Ocean Server
Login or create an account and spin up a new ubuntu 14.04 droplet at www.digitalocean.com, it is pretty self explanatory. In the options, you should choose login through SSH if you want to follow this article step by step.
Then login to your Server:
ssh root@
<yourIp>
(e.g. ssh root@46.101.131.21).
2. Install Apache
sudo apt-get update
sudo apt-get install apache2
When you type
<yourIp>
into your browser (e.g.
3. Change index.html
Now "hosting static files" can mean two things. Either you want to host something like mycoolfile.txt or you want a classic website.
Option 1: Host files for downloading
- Switch directory to
cd /var/www/html
and remove the index.html file (rm index.html
) - Copy the files to your server. Navigate to the directory containing your file in a new terminal window and
scp mycoolfile.txt root@<yourIp>:/var/www/html
.
You should see the following result when navigating to yourIp in your browser:
Option 2: Host your personal website
- Switch directory to
cd /var/www/html
and remove the index.html file (rm index.html
) - Then
nano index.html
. Then you can write any valid html, for example:<!DOCTYPE html> <html> <body> <h2>Much Doge! Wow!</h2> <img src="https://s-media-cache-ak0.pinimg.com/736x/ee/b7/71/eeb771122eebac79dda2eb99d43e3d82.jpg" alt="Doge" width=300px> </body> </html>
which should yield: