<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Static Site Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/static-site/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/static-site/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Tue, 12 Aug 2025 18:00:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>Static Site Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/static-site/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Simple Static Website Hosting with Caddy and Let’s Encrypt</title>
		<link>https://serverstadium.com/knowledge-base/caddy-static-site-lets-encrypt-dedicated-servers/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Tue, 12 Aug 2025 18:00:35 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=12192</guid>

					<description><![CDATA[<p>Introduction This step-by-step guide shows how to host a static website with Caddy (automatic HTTPS included) on a ServerStadium dedicated server or a ServerStadium VM running Ubuntu 24.04. You’ll install Caddy, point your domain, enable free TLS via Let’s Encrypt, and add simple caching—no prior Nginx/Apache experience required. Prerequisites A ServerStadium dedicated server or VM&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/caddy-static-site-lets-encrypt-dedicated-servers/">Simple Static Website Hosting with Caddy and Let’s Encrypt</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">This step-by-step guide shows how to host a static website with <strong>Caddy</strong> (automatic HTTPS included) on a <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium dedicated server</a> or a <a href="https://serverstadium.com/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium VM</a> running Ubuntu 24.04. You’ll install Caddy, point your domain, enable free TLS via Let’s Encrypt, and add simple caching—no prior Nginx/Apache experience required.</p>



<h2 class="wp-block-heading">Prerequisites</h2>



<ul class="wp-block-list">
  <li>A <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium dedicated server</a> or <a href="https://serverstadium.com/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">VM</a> with Ubuntu 24.04.</li>
  <li>A domain name with an A/AAAA record pointing to your server’s public IP.</li>
  <li>SSH access with a sudo-capable user, and an email address for TLS notices.</li>
</ul>



<h2 class="wp-block-heading">Step 1 — Install Caddy (Official Repository)</h2>



<p class="wp-block-paragraph">Install from Caddy’s official repository to get the latest stable version.</p>


<pre><code>sudo apt update
sudo apt -y install debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt -y install caddy
</code></pre>


<h2 class="wp-block-heading">Step 2 — Create Your Web Root and a Test Page</h2>


<pre><code>sudo mkdir -p /var/www/static-site

sudo tee /var/www/static-site/index.html >/dev/null <<'EOF'
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Welcome</title></head>
<body>
  <h1>It works! Caddy on ServerStadium</h1>
  <p>Your static site is live and ready for content.</p>
</body>
</html>
EOF

# The Caddy service on Ubuntu runs as the "caddy" user; grant read access:
sudo chown -R caddy:caddy /var/www/static-site
</code></pre>


<h2 class="wp-block-heading">Step 3 — Configure Your Caddyfile (Automatic HTTPS)</h2>



<p class="wp-block-paragraph">Replace <code>example.com</code> with your domain. Caddy will automatically obtain and renew TLS certificates from Let’s Encrypt as long as DNS points to your server.</p>


<pre><code>sudo tee /etc/caddy/Caddyfile >/dev/null <<'EOF'
{
  email you@example.com
}

example.com, www.example.com {
  root * /var/www/static-site
  file_server
  encode gzip zstd

  @assets {
    path *.css *.js *.png *.jpg *.jpeg *.svg *.ico *.webp *.woff *.woff2
  }
  header @assets Cache-Control "public, max-age=31536000, immutable"
}
EOF

# Validate and apply:
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl enable --now caddy
sudo systemctl reload caddy
</code></pre>


<h2 class="wp-block-heading">Step 4 — Open the Firewall</h2>


<pre><code>sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
</code></pre>


<h2 class="wp-block-heading">Step 5 — Test Your Site</h2>



<ul class="wp-block-list">
  <li>Visit <code>http://example.com</code> first—Caddy will redirect to HTTPS after the certificate is issued.</li>
  <li>Check the service logs if needed: <code>sudo journalctl -u caddy -n 100 --no-pager</code>.</li>
</ul>



<h2 class="wp-block-heading">Optional: Redirect “www” to Root (or Vice Versa)</h2>



<p class="wp-block-paragraph">The site label above already covers both <code>example.com</code> and <code>www.example.com</code>. If you prefer a strict redirect, use two site blocks like this:</p>


<pre><code>sudo tee /etc/caddy/Caddyfile >/dev/null <<'EOF'
{
  email you@example.com
}

www.example.com {
  redir https://example.com{uri} permanent
}

example.com {
  root * /var/www/static-site
  file_server
  encode gzip zstd
  @assets { path *.css *.js *.png *.jpg *.jpeg *.svg *.ico *.webp *.woff *.woff2 }
  header @assets Cache-Control "public, max-age=31536000, immutable"
}
EOF

sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
</code></pre>


<h2 class="wp-block-heading">Deploying Content</h2>



<ul class="wp-block-list">
  <li>Place files under <code>/var/www/static-site</code> (HTML, CSS, JS, images). Caddy serves them instantly—no reload required unless you change the Caddyfile.</li>
  <li>For simple versioning, keep your site in a Git repo and deploy with <code>git pull</code> to the web root.</li>
</ul>



<h2 class="wp-block-heading">Optional: Basic Password Protection</h2>



<p class="wp-block-paragraph">Protect a folder with Basic Auth while you stage content. Generate a hash and add a rule:</p>


<pre><code># Generate a password hash:
caddy hash-password --plaintext 'YourStrongPassword!'

# Example Caddyfile snippet to protect /private
example.com {
  root * /var/www/static-site
  file_server
  basicauth /private {
    admin JDJhJDE...paste-the-generated-hash-here...
  }
}
</code></pre>


<h2 class="wp-block-heading">Troubleshooting</h2>



<ul class="wp-block-list">
  <li><strong>Certificate not issued:</strong> Confirm DNS A/AAAA records point to your server and ports 80/443 are open. Check logs: <code>journalctl -u caddy</code>.</li>
  <li><strong>403/404 errors:</strong> Verify <code>root *</code> path and file permissions. Ensure web root is readable by the <code>caddy</code> user.</li>
  <li><strong>Changes not applied:</strong> After editing <code>/etc/caddy/Caddyfile</code>, run <code>sudo caddy validate</code> then <code>sudo systemctl reload caddy</code>.</li>
</ul>



<p class="wp-block-paragraph">Want a hassle-free start? Choose an instant, low-cost <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&amp;utm_medium=article&amp;utm_campaign=dedicated_server">ServerStadium dedicated server</a> and deploy your static site in minutes.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">You’ve deployed a secure static website with automatic HTTPS using Caddy on ServerStadium infrastructure—fast, simple, and production-ready. For more help or information about ServerStadium services, visit our <a href="https://serverstadium.com/knowledge-base/?utm_source=kb&amp;utm_medium=article&amp;utm_campaign=dedicated_server">knowledge base</a> or the <a href="https://serverstadium.com/?utm_source=kb&amp;utm_medium=article&amp;utm_campaign=dedicated_server">ServerStadium website</a>.</p>

<p>The post <a href="https://serverstadium.com/knowledge-base/caddy-static-site-lets-encrypt-dedicated-servers/">Simple Static Website Hosting with Caddy and Let’s Encrypt</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
