## Introduction This guide walks you through hosting a simple website on a Virtual Machine (VM) in Atlas Cloud using the web console. You'll create a VM manually, install a web server, upload your website files, and configure DNS. > **For infrastructure-as-code**: See [[Website hosting with Terraform]] for automated deployment with version control and remote state management. ## Prerequisites - An Atlas Cloud account - A registered domain name (e.g., yourdomain.com) — optional - Basic knowledge of SSH and command-line tools ## Step 1: Create a Virtual Machine See [[Creating your first cloud service]] for a tutorial on creating a VM. See [[Instances]] and [[Guest Networks]] for further details of the following steps. 1. Log in to the [Atlas Cloud Platform](https://alpha.runatlas.is). 2. Create a guest network if you don't have one (see [[Guest Networks]]). 3. Create a new instance (see [[Instances]]), click "Add Instance" and configure: - Name: web-server - Template: Ubuntu 24.04 LTS - Compute offering: Select `Small Instance` (0.5 vCPU, 0.5 GB RAM) - Networks: Select the network you created above 4. Click "Launch VM". ## Step 2: Assign a Public IP and Configure Firewall 1. Go to Networking > Public IP Addresses. 2. Acquire a new public IP if needed. 3. For the public IP, configure port forwarding: - Protocol: TCP - Public port: 80 (for HTTP) - Private port: 80 - VM: Select your web-server instance 4. Repeat for HTTPS (port 443 to 443). 5. Set firewall rules to allow HTTP and HTTPS traffic. ## Step 3: Connect to Your VM 1. Use SSH to connect to your VM using the public IP and your SSH key. ```bash ssh -i your-key.pem ubuntu@<public-ip> ``` 2. Update the system: ```bash sudo apt update && sudo apt upgrade -y ``` ## Step 4: Install a Web Server For this example, we'll use Apache on Ubuntu: 1. Install Apache: ```bash sudo apt install apache2 -y ``` 2. Start and enable Apache: ```bash sudo systemctl start apache2 sudo systemctl enable apache2 ``` 3. Verify it's running: ```bash sudo systemctl status apache2 ``` ## Step 5: Create and Upload Your Website Files Create a minimal `index.html` file on your local machine: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Welcome to Atlas Cloud</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="bg-gray-100 flex items-center justify-center min-h-screen"> <div class="text-center"> <h1 class="text-4xl font-bold text-blue-600 mb-4"> Hello from Atlas Cloud! ☁️ </h1> <p class="text-lg text-gray-700"> Your website is live and looking great on Atlas. </p> </div> </body> </html> ``` Upload it using SCP: ```bash scp -i your-key.pem ./index.html ubuntu@<public-ip>:/var/www/html/ ``` ## Step 6: Test Your Website 1. Open a browser and visit <http://your.ip.address>. 2. Ensure the site loads correctly. ![[index.html on Atlas.png]] Congratulations! Your website is now hosted on Atlas Cloud. ## Optional: Configure Your Domain 1. In your domain registrar's DNS settings, add an A record: - Name: `@` - Type: `A` - Value: `your.public.ip.address` (from the IP address view in the Atlas Console) 1. Wait for DNS propagation (may take up to 24 hours, but usually near-instant). 2. Visit your domain (e.g., <http://yourdomain.com>) to confirm. ## Optional: Add SSL with Let's Encrypt 1. Install Certbot (recommended method): ```bash sudo apt update sudo apt install certbot python3-certbot-apache -y ``` 2. Obtain a certificate: ```bash sudo certbot --apache -d yourdomain.com --non-interactive --agree-tos --email [email protected] --redirect ``` 3. Verify automatic renewal is enabled: ```bash sudo systemctl status certbot.timer ``` > **Note**: For automated infrastructure deployment, see [[Website hosting with Terraform]] for an IaC approach that includes SSL setup.