Static website


So you want to host a little static website on your VPS, or at least try to? LES is ideal for that. And to do that, you will need some kind of web server. As the amount of RAM is not in GBs but rather MBs we will use Nginx, not Apache or others. Why? Search.

Nginx is available in Debian repositories, but we will use packages from Nginx team. As website says: "Most Linux distributions and BSD variants have Nginx in the usual package repositories and they can be installed via whatever method is normally used to install software (apt-get on Debian, emerge on Gentoo, ports on FreeBSD, etc). Be aware that these packages are often somewhat out-of-date. If you want the latest features and bugfixes, it's recommended to build from source or use packages directly from "

Install nginx

To do that, few steps are required.

sudo touch /etc/apt/sources.list.d/nginx.list

Now edit this newly created file to looks like this:

deb squeeze nginx

deb-src squeeze nginx

This way you told your Debian to use this repo. But to be sure we have what we wanna have, you need to add key for this repo. Type following.


cat nginx_signing.key | sudo apt-key add -

Now we can install nginx like we did before when installing sudo. You should remember that.

Don't forget to run apt-get update, otherwise you wont be able to install nginx

Please make sure, that you installed version from official nginx repo. You can do it by typing following.

sudo apt-cache policy nginx

Output should be similar to this one.


Installed: 1.4.3-1~squeeze

Candidate: 1.4.3-1~squeeze

Version table:

*** 1.4.3-1~squeeze 0

500 squeeze/nginx i386 Packages

100 /var/lib/dpkg/status

0.7.67-3+squeeze3 0

500 squeeze/main i386 Packages

500 squeeze/updates/main i386 Packages

As you can see, installed version from official nginx is 1.4.3. Debian repo has version 0.7.67. Another reason for using official repo is support - it will be easier to get it in case you run into troubles. Debian version is probably a bit different from official one, thought it's not that simple.

Configuring nginx

Let's configure nginx so we can use it to serve people our simple website. We will use following file, so go ahead and open it with your favourite editor.


First thing we need to do is change Listen part. There is number 80, but it should looks like this:

listen [one-of-your-ipV6-addresses]:80 default ipv6only=on;

What we did here made server work with one of your IPv6 address and with port 80. And it will use only IPv6. Unfortunately the most people still use IPv4, but we will deal with it later.

Around line 9 you should see "root /usr/share/nginx/html". That's the folder where we will put our html files. You can keep it, or you can change it. I myself changed it to "/var/www". Folder does not exist yet, so let's create it. We will also change our user and folder so that we can put and edit files there without need to use sudo all the time.

sudo mkdir /var/www

sudo adduser username www-data

sudo chown -R www-data:www-data /var/www

sudo chmod -R g+rw /var/www

And to make changes we made in config file to take effect, let's restart nginx.

sudo /etc/init.d/nginx restart

Testing nginx

Your server should be reachable now. If you use IPv6, you can type your address in browser, if not use IPv6 proxy. Here is example for you.


As you probably have not put any files on your server yet, you might see and 404 error. Following is 404 from IPv6 proxy website.

The requested resource could not be loaded because the server returned an error: 403 Forbidden (?).

Copy files to server

We can do it easy with SCP (or WinSCP for Windows). Syntax is similar as with SSH.

scp -P YYYYY page.html [email protected]:/var/www

IPv4 connectivity

Opposite of IPv6, we ain't got any IPv4 addresses. There are more ways how to be reachable with IPv4 (search forums) and it's up to you what suits you better. I will not make any recommendations, I will only say which solution I use. You can also go with domain you set up during first steps.