A website on a VPS: Nginx and a free SSL certificate
Updated 25-10-2026
On a VPS you can run a website with your own domain and a free HTTPS certificate from Let's Encrypt. Below is an example for Debian and Ubuntu.
1. Point the domain to the VPS
At your domain registrar add an A record with your VPS IP address for yourdomain.com and www.yourdomain.com. The change usually works within minutes, sometimes after a few hours.
2. Install Nginx
apt update && apt install -y nginxIf you restrict traffic in the Firewall tab, open ports 80 and 443. At http://IP_ADDRESS you will see the Nginx welcome page.
3. Add your site
Create a folder for the site's files and a configuration file:
mkdir -p /var/www/yourdomain.com
nano /etc/nginx/sites-available/yourdomain.comPaste into the file:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/yourdomain.com;
index index.html;
}Enable the site and reload Nginx:
ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginxUpload the site's files (e.g. index.html) to /var/www/yourdomain.com, e.g. over SFTP.
4. Turn on HTTPS
apt install -y certbot python3-certbot-nginx
certbot --nginx -d yourdomain.com -d www.yourdomain.comCertbot gets the certificate, sets up the redirect to HTTPS and renews it by itself.
PHP sites and WordPress
For PHP sites install PHP-FPM and the MariaDB database (apt install -y php-fpm php-mysql mariadb-server). Running the application in Docker can also be easier: see Docker on a VPS.
Remember updates and securing the server: How to secure your VPS.