How to Host a Website on Your VPS (Nginx/Apache + PHP + SSL)

Estimated reading: 1 minute

To serve a website from your VPS, you need a web server (Nginx or Apache), your app runtime (PHP/Node/etc.), and SSL for HTTPS.

Step 1: Choose your web server

  • Nginx: lightweight and great performance
  • Apache: flexible, widely supported

Step 2: Install the web stack

Typical setups:

  • PHP sites: Nginx/Apache + PHP-FPM + MariaDB/MySQL (if needed)
  • WordPress: web server + PHP + database + caching

Step 3: Create a site configuration (virtual host)

Configure your domain to point to a folder on your VPS (example: /var/www/yourdomain), and set the site’s server name to your domain.

Step 4: Upload your website files

Upload via SFTP, Git, or deployment scripts. Confirm the site loads by IP before switching DNS.

Step 5: Install SSL (HTTPS)

Use an SSL tool (commonly Let’s Encrypt) to issue a certificate for your domain and enable HTTPS redirects after issuance.

Step 6: Test and harden

Confirm:

  • Correct file permissions
  • Firewall allows only required ports
  • HTTPS works and redirects are correct