How do I put up a simple, static website?

June 2, 2016 21.5k views
Getting Started

I am very to new web development and I am simply trying to put up a web page that just says "Hello, world". I would like to build a portfolio page to post the work that I've done in my programming classes but am unsure as to what I need to do have my simple webpage show up. I feel like I am missing a step or series of steps and maybe I just don't understand everything that is required but this is what I have done (successfully...I believe) thus far:

I don't know what the next steps are. I have uploaded an html file but that's where I feel like I am missing something. After I've uploaded it, is that it? Is there something significant that I am missing?

4 Answers

Hi @coolinmc6

You're definitely on the right track! After setting up the DNS records so that your domain points to your Droplet's IP address, and securing the Droplet (initial server setup), all you need to do is install a webserver and upload the files that it should serve.

The most popular webservers are Apache and Nginx. Nginx performs much better than Apache at serving static files, so I would recommend going with that. Take a look at this tutorial:

Once you've followed it and installed Nginx, you'll want to configure it to use a new path for the files. While you can use almost any path you want, I personally prefer /srv/www. Create that directory, and another directory in it for your domain name in order to make it easier to add other websites with different domain names in the future:

sudo mkdir /srv/www /srv/www/

Then, configure nginx to serve files from that directory. Open /etc/nginx/sites-available/default in your favorite text editor and update the line with the root directive such that it looks as follows:

    root /srv/www/;

Restart nginx in order for the changes to take effect:

sudo service nginx restart

Finally, change the directory ownership to your own user so that you can write to it:

sudo chown -R user:user /srv/www

And you're done! You can now upload your website's files using FileZilla to /srv/www/, which you should then see at

by Justin Ellingwood
Nginx is one of the most popular web servers in the world. It is extremely flexible and powerful and can be used to efficiently host sites and applications small or large sites and applications. In this guide we'll cover how to install and set this up on an Ubuntu 14.04 server.
  • I installed nginx. How do I open /etc/nginx/sites-available/default in a text editor? Thanks

    • I installed emacs on my server, but how do I navigate to that directory /etc/ ? I couldn't see it when emacs showed list of directories. Also I try to use ^ to navigate up a directory but I get "Reading directory: no such file or directory, /direxample/^" so I don't know how to navigate to the root directory where I would think /etc would be.

      • @cidetraq I don't have much experience with emacs myself but nano is another editor that is much easier to use. Run nano /path/to/file and use the arrow keys to navigate the file and edit it. Hit CTRL-X to exit the file, then Y to save the changes that you made, then ENTER to confirm the file name.

Just thought I would note, remember to allow access to port 80 as explained in the Additional Recommended Settings guide if you had previously set up a firewall.

I was working on an old droplet and kept receiving 504 errors. It took me hours to figure out that was the issue.

After setting up the bare recommended configuration for a new server, there are often some additional steps that are highly recommended in most cases. In this guide, we'll continue the initial configuration by tackling some recommended, but optional procedures.

i tried to edit the root line using nano

after editing

i clicked ctrl-x and inputted Y

i got this

*[ Error writing /etc/nginx/sites-available/default: Permission denied ]

please i need help urgently

Have another answer? Share your knowledge.