A VPS is a virtual machine hosted on a server, it's very cheap (as of now, mine cost 1$ / month for 2go of RAM and 20go of storage).
It allows me to store more data than github and can do processing, I may now (god forgive me for what I'm about to say) make dynamic webpage !
All of this came from the fact that I wanted to make a guest book, which needed php or a kind of processing that coudn't be static (although you may ask people to send you mail and post it after, such as this lovely website shoerack).
There will probably be a page on php soon.

Doing the setup of a server has been easier than I thought, taking a day from no vps to functional website with no previous knowledge of server managment. I chose a debian 10 distrib, I never used linux and thought trying debian would be fun (it is).
It's not really an informed desicion, I think I heard somewhere that a lot of server runned on debian, after a bit of research it seems it is one of the most popular with ubuntu server.
So here I go, sshing into my faraway server for the first time !

For a server to serve a website, there is some stuff you gotta take care of This stack of software is know as LAMP (Linux Apache MySQL PHP), there is a lot of variant. Here I'm using LEMP (Linux Nginx MySQL PHP).
Also I don't use SQL because I don't have any data to store on my website.


Debian is preinstalled when I connect to the server, the first step is to install nginx, for this you'll use the package manager of debian : APT (Advanced Package Manager).
You'll find tutorial that use apt, other that use apt-get, both share some commands, apt-get is more backward compatibity oriented, apt is more fancy, with added search fonctionality for exemple.
Just to be safe, you should probably update the package manager beforehand
sudo apt update
And then install nginx
sudo apt install nginx
You can then check if nginx is running
sudo service nginx status

If nginx is correctly running, you should see some nginx default html file when typing your vps adress in your browser search bar.

You will find the configuration stuff under
Most of the usefull stuff will be in this file
In it you will find the port you are lisening to and the root folder of your website : /var/www/html/

Now you may clone your website repo to this place !
sudo apt install git
cd /var/www/html
git clone https://github.com/USERNAME/REPONAME.git
To copy all the content out of the dir (which is probably not the cleanest way of doing it), I used
cp -a /source/. /dest/
Then, delete the directory
sudo rm -r source


Your website may not load correctly on all browser if it can't serve https, the encrypted big brother of http.
To serve https you need an SSL certificate, when connecting to the server, your browser check the certificate and handshake to start the encrypted connection if everything is ok.
Certificates are delivered by Certificate Authority, some cost money, some are free.
We'll use Let's Encrypt through Certbot, Let's Encrypt is free but need to be renewed every 2 months.

To install certbot we'll need another package manager : snap
sudo apt install snapd
sudo snap install core
Once it is done you can install certbot with
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx
The last command will automatically edit your nginx config file to use https.


FastCGI is a protocol for interfacing program with a web server.
php-fpm is a wrapper of php for fastCGI, it runs php as a separate server, nginx sends query to the php server when needed.
First, install the php-fpm package (in my case it's 8.2 but it may vary).
sudo apt install php8.2-fpm
verify if the service is running
sudo service php8.2-fpm status
if not, use
service php8.2-fpm start
To connect php-fpm to nginx, edit the nginx config file to add index and uncomment the location
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name your_server_ip;

    location / {
        try_files $uri $uri/ =404;
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php8.2-fpm.sock;

    location ~ /\.ht {
        deny all;
Remember to change the php version version depending on yours !!
Test for syntax error
sudo nginx -t
then reload nginx
sudo systemctl reload nginx

Changing permission if PHP can't write

Create a PHP file containing the following:
        <?php echo `whoami`; ?>
Upload it to your web server. The output should be similar to the following:
Therefore, the PHP user is www-data.

By using ls -dl, you can see the permission and owners of the directory you are in, example at root
        debian@vps-d1a0526b:~$ ls -dl
drwxr-xr-x 7 debian debian 4096 Dec 9 12:59 .
You can add this user to the owners of a directory by using
sudo chown -R www-data directory
You can reuse ls -dl to check if www-data has been correctly added to the owners.


The last step is to link the IP of your server to a url to make it easily accessible, the method will vary depending on your domain provider.

File transfer

To transfer file from your computer to your server you are suppose to use some kind of file transfer protocol such as SFTP.
I'm lazy so I use visual studio code to drag and drop stuff in the explorer.


- home -