Servers & VPS

How to Host Your Website on Your Own Server or VPS

Learn step by step how to host a website on your own server or VPS, from choosing an operating system to publishing your site online.

Detailed image of a server rack with glowing lights in a modern data center.

To host a website on your own server or VPS you need to install a Linux operating system, set up a web server (Apache or Nginx), point your domain to the server's IP address, and upload your site files. You can have your site live in under an hour.

This tutorial assumes you already have SSH access to your VPS (or your own machine) and will use Ubuntu 22.04 LTS, the most popular distribution for web hosting. If you are still choosing a provider, check our guide on VPS servers.

Physical Server or VPS? Decide Before You Start

Before diving into commands, it is worth deciding what kind of "own server" you will use. The steps are identical, but the costs and commitments are very different.

  • VPS (Virtual Private Server): a virtual machine hosted in a data center. You pay from a few dollars per month. Guaranteed uptime, fixed IP, no worrying about electricity or hardware.
  • Physical server at home or office: an old computer or mini-PC connected to your router. One-time hardware cost, but dependent on your home internet (dynamic IP, possible outages) and keeping the machine on 24/7.

For a business site or real traffic, a VPS is almost always the right choice. For learning or testing, any old machine works fine.

Step 1 — Update the Server and Install a Web Server

Connect via SSH and run security updates first:

sudo apt update && sudo apt upgrade -y

Then install Apache (the easiest option for beginners):

sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2

Open the server's public IP in your browser. If you see Apache's welcome page, the web server is running.

Apache or Nginx?

Apache is easier to configure for PHP sites using .htaccess files. Nginx uses less memory and handles high concurrency better. For a first site, Apache is the practical choice. You can migrate to Nginx later.

Step 2 — Point Your Domain to the Server

In your domain registrar's panel, create an A record pointing your domain (or subdomain) to your VPS's public IP.

Type Name Value TTL
A @ (root) 203.0.113.45 (your IP) 3600
A www 203.0.113.45 (your IP) 3600

DNS propagation takes between 5 minutes and 48 hours depending on the previous TTL. You can check propagation with dig yourdomain.com from the terminal.

Step 3 — Create a VirtualHost for Your Domain

In Apache, each site has its own configuration file in /etc/apache2/sites-available/. Create one for your domain:

sudo nano /etc/apache2/sites-available/yourdomain.conf

Paste this basic configuration (replace yourdomain.com and the path to your files):

<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/yourdomain
    ErrorLog ${APACHE_LOG_DIR}/yourdomain_error.log
    CustomLog ${APACHE_LOG_DIR}/yourdomain_access.log combined
</VirtualHost>

Enable the site and reload Apache:

sudo mkdir -p /var/www/yourdomain
sudo a2ensite yourdomain.conf
sudo systemctl reload apache2

Step 4 — Upload Your Website Files

You have two main options for transferring your files to the server:

  • SFTP (recommended): use FileZilla or another SFTP client with the same SSH credentials. It is secure and encrypted.
  • SCP from the terminal: scp -r ./my-site user@IP:/var/www/yourdomain/
  • Git: if your site is in a repository, install git on the server and run git clone directly into the site folder.

Make sure Apache can read the files:

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

Step 5 — Enable HTTPS with Let's Encrypt (Free)

A site without SSL appears as "not secure" in browsers and harms SEO. Certbot automates certificate installation:

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com

Certbot configures the automatic HTTP-to-HTTPS redirect and renews the certificate every 90 days without manual intervention.

Would you rather have someone handle all of this for you? At elenlace.com we take care of hosting, configuration and ongoing maintenance so you can focus on your business.

Key Takeaways

  • A VPS is the most practical and reliable option for hosting a business site on your own server.
  • The basic flow is: update the OS → install Apache/Nginx → point the domain → create VirtualHost → upload files → enable SSL.
  • HTTPS with Let's Encrypt is free and renews automatically; there is no excuse to leave a site without a certificate.
  • SFTP or SCP are the secure ways to transfer files; avoid unencrypted plain FTP.
  • Set the correct permissions (www-data) so Apache can serve files without errors.

Ready to get your site on your own server without the learning curve? Contact us at elenlace.com and we will help you configure your VPS from scratch.

FAQ

Do I need to know how to code to host my site on a VPS?

You do not need to know how to code, but you do need to be comfortable with basic Linux terminal commands. This tutorial covers exactly what you need. If you prefer a graphical interface, install a panel like Webmin or cPanel.

Can I host multiple websites on the same VPS?

Yes. Create a separate VirtualHost for each domain pointing to different folders. Apache serves each domain independently from the same server.

What happens if the power or internet goes out on my home server?

Your site goes offline until the connection is restored. That is why a data center VPS is recommended for business sites — it has generators, network redundancy, and uptime guaranteed by contract.

How much does it cost to maintain a VPS for a small site?

A basic VPS typically costs between $5 and $20 USD per month depending on the provider and region. For moderate traffic, a plan with 1 vCPU and 1–2 GB RAM is usually enough to start.

Useful resources

Other providers and guides worth comparing:

← All