Create a Website with Carpathian Cloud
2024-04-15
This guide will walk you through how to use Apache2 to build and manage a basic website on your Carpathian virtual machine.
Prerequisites
Before you begin, make sure:
- You already provisioned a server from your dashboard.
- Apache2 is installed (
sudo apt install apache2 -y
if it isn't) - You can SSH into your VM (press the "console" button)
Step 1: Locate the Apache Web Root
By default, Apache serves files from:
/var/www/html
This is where you should place your website files. You can delete the default index.html
and replace it with your own.
sudo rm /var/www/html/index.html
Then add your own:
echo "<h1>Hello from Apache on Ubuntu!</h1>" | sudo tee /var/www/html/index.html
Step 2: Edit Website Files on the Server
You can use any command-line text editor. The most common are:
Nano (simple)
sudo nano /var/www/html/index.html
Vim (advanced)
sudo vim /var/www/html/index.html
Generally you can just paste in code prewritten in a common editor (VS Code, etc.).
Step 3: Restart Apache (if needed)
Apache detects most changes automatically, but you can manually restart it with:
sudo systemctl restart apache2
Step 4: Test in Browser
Visit your server's public IP:
https://yourwebaddress.com
Your website should load instantly.
Optional: Organize Multiple Sites
You can create subdirectories in /var/www/html
or configure new virtual hosts to serve different domains. For basic usage, a single site in /var/www/html
is enough.
You're All Set!
You now know how to use Apache2 on Ubuntu to edit, upload, and manage your own website. This is perfect for static sites, testing environments, or personal projects.
For more, you can always reach out and we're happy to walk you through developing a website on our cloud.
Want to use wordpress instead? Check out this doc: carpathian.ai/documentation/wordpress.