How to Host Your First Website on a VPS with Nginx

With a VPS you can host websites yourself. This guide uses the popular Nginx to take you from zero to live.

1. Install Nginx

On Ubuntu, after logging in run: sudo apt update && sudo apt install -y nginx. Once done, visit the server IP — the Nginx welcome page means success.

2. Upload site files

Put your web files in /var/www/html. Use scp or an SFTP tool to upload.

3. Configure the site

Create a config under /etc/nginx/sites-available, set server_name (your domain) and root (the site directory), symlink it into sites-enabled, run sudo nginx -t to check syntax, then sudo systemctl reload nginx to apply.

4. Point your domain

At your domain registrar, set the domain's A record to the server IP and wait for DNS to propagate to access by domain.

5. Add HTTPS

Enable HTTPS with a free Let's Encrypt certificate — see "How to get a free SSL certificate."

The process is straightforward; reach out to 00Shark support with any issues.

Artikel ini disediakan dengan bantuan AI oleh pasukan editorial SharkCloud dan disemak sebelum diterbitkan.