To host a website on your own VPS server, you need to provision a virtual server, install a web server (Apache or Nginx), configure PHP and a database, upload your site's files, and point your domain to the VPS IP address.
Running your own VPS gives you complete control over your web hosting environment: install any software, scale resources on demand, and never share capacity with other users. This guide walks you through the full process, step by step, written for those who haven't managed a server before.
What You Need Before You Start
Have the following ready before you configure anything:
- A provisioned VPS: choose a provider with servers in or near your target region for low latency. A plan with 1 vCPU, 1–2 GB RAM, and 20 GB SSD storage is enough to get started.
- A Linux OS: Ubuntu 22.04 LTS or AlmaLinux 9 are popular, stable, and well-documented choices.
- SSH access: your provider will give you an IP address, a username (usually
rootor a custom one), and a password or SSH key. - A domain name: it must be registered and you need access to edit its DNS records.
| Resource | Minimum recommended | For higher-traffic sites |
|---|---|---|
| RAM | 1 GB | 2–4 GB |
| CPU | 1 vCPU | 2 vCPU |
| Storage | 20 GB SSD | 50 GB SSD or NVMe |
| Bandwidth | 1 TB/month | 2–5 TB/month |
Step 1: Connect to the Server and Update the System
From your terminal, connect to your VPS via SSH:
ssh root@YOUR-VPS-IP
Once connected, update all system packages:
# On Ubuntu/Debian:
apt update && apt upgrade -y
# On AlmaLinux/CentOS:
dnf update -y
Then create a non-root user for day-to-day operations (using root for everything is a poor security practice):
adduser youruser
usermod -aG sudo youruser
Step 2: Install the Web Server and PHP
A web server is the software that receives HTTP requests and serves your site's files. The two most common options are Apache (simpler to configure, ideal for beginners) and Nginx (more efficient under high load).
Apache Installation (Ubuntu)
apt install apache2 -y
systemctl enable apache2
systemctl start apache2
PHP Installation
apt install php php-mysql php-curl php-gd php-mbstring php-xml -y
Verify it works by opening http://YOUR-VPS-IP in your browser. You should see the Apache welcome page.
Step 3: Install MariaDB and Create a Database
If your site uses a database (WordPress, PrestaShop, or any PHP application), you need a database server:
apt install mariadb-server -y
mysql_secure_installation
The mysql_secure_installation wizard guides you through setting a root password and removing test users and databases. Follow all recommendations.
Create a database and user for your website:
mysql -u root -p
CREATE DATABASE my_site_db;
CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON my_site_db.* TO 'my_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 4: Upload Your Site and Configure a Virtual Host
Place your site's files in the appropriate Apache directory:
/var/www/html/yourdomain.com/
Then create a Virtual Host configuration file so Apache knows how to serve your domain:
/etc/apache2/sites-available/yourdomain.com.conf
Basic Virtual Host contents:
<VirtualHost *:80>
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /var/www/html/yourdomain.com
ErrorLog ${APACHE_LOG_DIR}/yourdomain-error.log
CustomLog ${APACHE_LOG_DIR}/yourdomain-access.log combined
</VirtualHost>
Enable the site and reload Apache:
a2ensite yourdomain.com.conf
systemctl reload apache2
If you need help with server configuration or prefer to have experts manage it for you, elenlace.com offers managed VPS hosting where we take care of the entire infrastructure.
Step 5: Install SSL and Point Your Domain to the VPS
Free SSL Certificate with Let's Encrypt
apt install certbot python3-certbot-apache -y
certbot --apache -d yourdomain.com -d www.yourdomain.com
Certbot automatically configures the certificate and redirects HTTP traffic to HTTPS. The certificate auto-renews every 90 days.
DNS Update
In your domain registrar's panel, update the A record to point to your VPS IP:
- A record for
yourdomain.com→ your VPS IP - A record for
www.yourdomain.com→ your VPS IP
DNS propagation takes anywhere from a few minutes to 48 hours. Once complete, your site will be live at https://yourdomain.com.
Browse more server and configuration guides in our VPS servers section.
Key Takeaways
- Hosting a website on your own VPS requires installing and configuring a web server, PHP, a database, and SSL.
- Ubuntu LTS is the most beginner-friendly Linux distribution thanks to its documentation and community support.
- Always operate the server as a non-root user and keep unnecessary ports closed.
- Let's Encrypt provides free, automated SSL certificates — there is no excuse for running a site without HTTPS.
- A managed VPS removes most of the technical complexity if you don't have Linux server experience.
Want to publish your website without dealing with server configuration? elenlace.com offers managed VPS plans with Spanish-language technical support, SSL included, and active monitoring.
FAQ
Is it hard to host a website on your own VPS server?
It depends on your Linux experience. If you're comfortable with the command line, the process is manageable with a guide like this one. If you have no server experience, a managed VPS or a control panel like cPanel or CyberPanel significantly reduces the technical complexity.
How much does it cost to host a website on a VPS?
VPS plans vary widely. Entry-level plans start around $5–$15 USD/month, while plans with more resources (RAM, CPU, storage) run $20–$60 USD/month. For a small to medium website, a $10–15/month plan is typically more than enough to start.
Do I need a control panel like cPanel to host my site on a VPS?
No, it's not required. You can manage everything via SSH. However, a control panel simplifies tasks like creating FTP accounts, managing email, configuring domains, and running backups — especially if you're not experienced with Linux administration.
Can I host multiple websites on a single VPS?
Yes. Both Apache and Nginx support multiple Virtual Hosts, meaning you can host dozens of different websites on one VPS, each with its own domain, database, and SSL certificate. Just make sure the VPS has enough resources to handle all of them.
Further reading
Other providers and guides worth comparing: