Host static files with Apache on Digital Ocean

April 2016

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. ), y ou should now be able to see the following:

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

  1. Switch directory to cd /var/www/html and remove the index.html file (rm index.html)
  2. 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

  1. Switch directory to cd /var/www/html and remove the index.html file (rm index.html)
  2. 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:

 
Dear Devs: You can help Ukraine🇺🇦. I opted for (a) this message and (b) a geo targeted message to Russians coming to this page. If you have a blog, you could do something similar, or you can link to a donations page. If you don't have one, you could think about launching a page with uncensored news and spread it on Russian forums or even Google Review. Or hack some russian servers. Get creative. #StandWithUkraine 🇺🇦
Dear russians🇷🇺. I am a peace loving person from Switzerland🇨🇭. It is without a doubt in my mind, that your president, Vladimir Putin, has started a war that causes death and suffering for Ukrainians🇺🇦 and Russians🇷🇺. Your media is full of lies. Lies about the casualties, about the intentions, about the "Nazi Regime" in Ukraine. Please help to mobilize your people against your leader. I know it's dangerous for you, but it must be done!