How should I move my hand-coded static site to my own domain?
Asked by
MellowPine42
I recently learned enough HTML and CSS to build a cheesy old-web-style personal site, and it's currently hosted on a free static-site service. I also have a small server running Nginx for Jellyfin, plus a few inexpensive domain names. I'd like to move the site to one of my domains, but I'm unsure how to set it up.
I initially tried Hugo because it seemed like a popular option, but nothing appears at http://localhost:1313, and I'm not sure Hugo is even reading the HTML files I copied into its folders. It also seems to expect me to choose a theme, even though I already spent a lot of time creating my own layout. The documentation feels fairly advanced, so I'm wondering whether there's a simpler tool or a better way to understand what I should be doing.
Answers
Keep your existing page paths if possible, especially if anyone already has links to them. If a pageโs address has to change, set up redirects rather than leaving the old URL broken. Also, you donโt need to abandon the handmade layout just because you switch hostingโthe files can be served exactly as they are.
Reply to this answer
Add a separate Nginx server block for the new domain and point it at your site directory. For example:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
After enabling the configuration, run `sudo nginx -t` to check it, then reload Nginx. Put your HTML, CSS, images, and other assets under `/var/www/example`. Once the domain resolves to your server, Certbot can add HTTPS with a command such as `sudo certbot --nginx -d example.com -d www.example.com`. You can copy the files over once, then use Git or rsync for future updates.
Reply to this answer
If you donโt want to expose your home server or maintain Nginx, a managed static host is another easy route. Services such as Cloudflare Pages, Netlify, or GitHub Pages can deploy a plain HTML/CSS folder and connect it to a custom domain with automatic SSL. Thatโs often less work for a small personal site.
Reply to this answer
You probably donโt need Hugo at all. Itโs mainly for generating pages from Markdown and templates, so putting completed HTML files into it isnโt really how itโs designed to work. Since your site is already hand-coded, the simplest option is to serve that folder directly with Nginx. You can always add a generator later if you eventually want blog posts, reusable templates, or other automation.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions