Let’s not only create a website, lets serve it so that others can see it!
Because you already have a SSG Generated Web, dont you?
What You Will Need | How to Do It |
---|---|
Domain registration | Register a domain name (e.g., yourdomain.com) with a domain registrar. |
Adapt some Code | Just some willingness to do so |
DNS configuration | Be ready to configure some DNS |
Ready to say goodbye to that costly monthly hosting subscription?
Use SSG themes, because they are: crazy fast, SEO Optimized AND MIT LICENSED ❤️
Pss, and you can also do PPTs with them!
What We Will Setup | Options to Host Static Sites (DIY) |
---|---|
NGINX | Lightweight, high-performance web server. |
Lighttpd | Lightweight web server optimized for speed. |
Apache HTTP Server | Widely-used, robust web server with extensive features. |
Caddy | Simple, user-friendly web server with automatic HTTPS. |
Let’s get started with this chapter of our SelfHosting Journey:
- Pre-Requisites - Have a Static Site to Host
- DIY Hosting for Static Sites - We will focus on lightTPD, but there are more options
- (Optional) - Monitor your site with F/OSS Analytics
Why Static Websites
Like most of the people, I am not a web developer, but we might want to have a WebPage.
Paying $$$ for a domain+wordpress/wix is not an option for most of us, which is the most common process to get started. Blogger is also out of the equation.
You could also SelfHost Wordpress/Ghost, but… ⏬
Arent’t they a little bit heavy?
Do I need to do all those configurations via UI and backups?
But we are lucky, as there are Free and Open Source ways to have our own place in the internet.
We can use Wordpress or Ghost as they are open source projects, those projects need a hackable database
You are not sure how those Themes can look like? Well…have a look to:
Static WebSites Generators
Today, we are interested in static sites, like the good old internet, just plain files: html, js, css, no database at all - that cover most of our use case.
And if you are wondering - They also look cool (and are crazy efficient) 😉
And we are not going to write every single line of code - for that, we use the SSGs:
Think of them as templates, where you can just focus in your content.
You are done already and have the build done? Oh, no you need some server to host it and serve the files whenever someone wants to visit you.
And this time, you want to use a DIY solution to host your static site.
SelfHosting your (Static) Website
Lighttpd (lighty)
Lighttpd is known for its speed and efficiency, making it an excellent choice for serving static content.
It’s easy to configure and suitable for small to medium-sized websites.
- Lighttpd
- Lighttpd is Licensed MIT
- And we can use Lighttpd with its Docker Image
How to use LightHTTPd to serve your Static Website ⏬
Nginx
Nginx is another popular open-source web server known for its performance and scalability. It’s often used for both static and dynamic content and can be highly optimized for various use cases.
SelfHosting NGINX WebServer with Docker ⏬
Apache HTTP Server (with mod_rewrite):
Apache is one of the most widely used web servers and can be configured to serve static content efficiently.
When serving static content, it can be configured for excellent performance, especially with the mod_rewrite module.
Setup Apache Server with Docker ⏬
Caddy
Caddy is a modern, open-source web server known for its ease of use and automatic HTTPS support.
It’s particularly suitable for serving static sites and can automatically obtain SSL/TLS certificates for secure connections.
How to Setup Caddy with Docker ⏬
Conclusions
We have seen some SelfHosted and Free Open Source Software alternatives to the 3rd Party Managed solutions that offer free tiers plans (even free domains if you dont have one).
How to use Google/CloudFlare/Github to host your SSG ⏬
- Cloudflare Pages:
- Fast and secure global distribution with built-in CDN and SSL/TLS encryption. Limited to static sites only and may have limited features due to being in beta stage.
- Firebase:
- Scalable hosting with integrated services like authentication, database, and analytics. Limited customization options and may not be suitable for high traffic websites.
- GitHub Pages:
- Free hosting with seamless integration with GitHub, perfect for personal projects or documentation sites.
Remember that when you use those, you are accepting their terms and conditions (which may change at any point in the future).
Isnt’t it worth it just to DIY✅
Now, you can use your domain, together with your website and be in total control not only of the content, but on how it is served to your visitors.
Certainly! Here’s a markdown table comparing Subatic with two other open-source services for hosting images:
Service | License | Primary Use | Pro | Con |
---|---|---|---|---|
Subatic | Open Source (GPL v3) | Video hosting | Extremely simple and scalable video hosting | Focuses only on video, not images |
Piwigo | Open Source | Photo management | Extensive features and plugin support | More complex setup and configuration |
Lychee | Open Source | Photo management | Simple and user-friendly interface | Limited advanced features compared to Piwigo |
MediaCMS | aGPL | Video and Media CMS | open source video and media CMS, written in Python/Django and React, featuring a REST API. |
https://medevel.com/os-photo-collection-self-hosted/
FAQ
A Hackable DataBase? About BackUps ⏬
Whatever software has a risk of being hacked.
This does not means that for a project (website for us now) having a website, this one will have to get hacked.
But you will need to think (or paying someone for it) to setup proper backups, passwords, monitoring.
And static sites are a more robust solution in this sense - Simply because they dont need a database.
So if you are about to have your first website - why not considering SSGs?
Surprise! Your Static Site does not need a database backup – because it simply does not have one ✅.
Make sure to know where to store your SSG code, and host it wherever you want.
How is my Website Performing?
You can have a look how much people like your content with F/OSS Web Analytics:
- Umami – a simple, fast, privacy-focused alternative to Google Analytics.
- Plausible - aGPL v3
Simple, open source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.
- Matomo
Google Analytics alternative that protects your data and your customers’ privacy
Do I Got Any Broken Links?
If you are having a site for sometime already, it might be good to look that all referenced links are working from time to time.
But, manually…is not an option - Fortunately we can use LinkChecker Project with Python.
You will get a report with what’s link working and what not when it comes to Links in your Site.
How to Use LinkChecker with Docker ⏬
- We will be using their GHCR Image
#podman run --rm -it ghcr.io/linkchecker/linkchecker:latest --verbose https://fossengineer.com > linkchecker_output.txt
docker run --rm -it -u $(id -u):$(id -g) ghcr.io/linkchecker/linkchecker:latest --verbose https://www.example.com
How to Monitor My Website Status
If you are worried if your website is accesible at any point of time, you can use:
- With UptimeKuma ❤️
A fancy self-hosted monitoring tool
- Or with UpTimeJS
Upptime is the open-source uptime monitor and status page, powered entirely by GitHub.
I need email with my domain
If you have a domain already – Next, you need to choose an email hosting provider. There are several options available:
a. Managed email hosting services: These are third-party providers that offer email hosting services, such as Google Workspace (formerly G Suite), Microsoft 365, or Zoho Mail. They provide a user-friendly interface to manage your email accounts and often include additional features like calendar and collaboration tools.
Name | Description |
---|---|
Resend | A transactional email API service for developers |
Postmark | A fast and reliable transactional email service |
Mailgun | A powerful email delivery service for sending, receiving, and tracking emails |
MailerLite | An email marketing platform for creating and sending newsletters, automated emails, and more |
SendGrid | A cloud-based email delivery service for transactional and marketing emails - For some reason I got insta banned after creating an account and CS could not explain why 😩 |
Mailtrap | A fake SMTP server for testing and viewing emails in a safe environment |
Interesting SMTP example - https://mariushosting.com/synology-set-up-email-notifications-on-solidinvoice/
b. Self-hosted email server: You can set up your own email server using software like Microsoft Exchange, Sendmail, Postfix, or Dovecot. This option requires more technical knowledge and server management skills.
How to Setup MailSlurper - Local SMTP Server👇
docker run -it -p 2500:2500 -p 8080:8080 -p 8085:8085 --rm marcopas/docker-mailslurper
or with:
version: '3.8' # You can choose a version according to your Docker Compose installation compatibility.
services:
mailslurper:
image: marcopas/docker-mailslurper
ports:
- "2500:2500" # Port for SMTP
- "8080:8080" # Port for the web interface
- "8085:8085" # Port for the API
stdin_open: true # Equivalent to -i in Docker CLI (attaches stdin)
tty: true # Equivalent to -t in Docker CLI (allocates a pseudo-TTY)
restart: "no" # Corresponds to --rm in Docker CLI (don't restart the container automatically)
UI at
localhost:8080
You can send some test emails with:
wget -qO- https://raw.githubusercontent.com/sedkodes/mailslurper/main/send-mail-test.py | python
Hot to Setup Poste with docker 👇
Thanks to https://github.com/jmlcas/mailserver and the video
services: #https://github.com/jmlcas/mailserver/blob/main/docker-compose.yaml
mailserver:
image: analogic/poste.io
container_name: mailserver2
restart: unless-stopped
#network_mode: "host"
expose:
- "25"
- "7080"
- "7443"
- "110"
- "143"
- "465"
- "587"
- "993"
- "995"
environment:
- TZ=Europe/Madrid
- h=mail.youwawsomedomain.com # Dirección del servidor de mail hosting
- HTTP_PORT=7080
- HTTPS_PORT=7443
- DISABLE_CLAMAV=FALSE # TRUE
- DISABLE_RSPAMD=FALSE # TRUE
- DISABLE_ROUNDCUBE=FALSE # TRUE
volumes:
- ./mail:/data
networks:
- nginx_default #this will allow communication between chevereto service and the existing nginx service
networks:
nginx_default:
external: true
Self-hosted newsletter and mailing list manager ⏬
- ListMonk - Self-hosted newsletter and mailing list manager - aGPL v3 ✅
- SendPortal - Open-source self-hosted email marketing. Manage your own newsletters at a fraction of the cost. MIT LICENSED ❤️
SendPortal integrates with Amazon SES, Postmark, Sendgrid, Mailgun and Mailjet.
- https://github.com/bokysan/docker-postfix - MIT LICENSED ❤️
Multi architecture simple SMTP server (postfix null relay) host for your Docker and Kubernetes containers. Based on Debian/Ubuntu/Alpine.
Let’s break this down:
configure your domain’s DNS ⏬
Once you have chosen your email hosting provider, you need to configure your domain’s DNS (Domain Name System) settings to point to the email server.
This typically involves adding MX (Mail Exchanger) records to your domain’s DNS zone.
MX records specify the mail server responsible for handling email for your domain.
The specific MX records to add will be provided by your email hosting provider.
SMTP (Simple Mail Transfer Protocol) ⏬
IMAP and POP3 ⏬
IMAP (Internet Message Access Protocol) and POP3 (Post Office Protocol version 3) are protocols used for retrieving incoming emails from the email server. IMAP allows you to access and manage your emails directly on the server, while POP3
IMAP allows you to access and manage your emails directly on the server, while POP3 downloads the emails to your local device and usually removes them from the server. Your email hosting provider will provide you with the IMAP/POP3 server details (hostname, port, authentication) that you need to configure in your email client to retrieve your incoming emails.
I need a URL shortener
Open-source link management infrastructure. Loved by modern marketing teams like Vercel, Raycast, and Perplexity.
- Sink - https://sink.cool/ https://github.com/ccbikai/Sink https://github.com/ccbikai/Sink?tab=AGPL-3.0-1-ov-file#readme
Deploy it with Cloudflare (?) https://github.com/ccbikai/sink?tab=readme-ov-file#%EF%B8%8F-deployment
⚡ A Simple / Speedy / Secure Link Shortener with Analytics, 100% run on Cloudflare.
kutt ⏬
Kutt is a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics.
YOURLS ⏬
#https://awsmfoss.com/yourls/
Snapp ⏬
- https://github.com/urania-dev/snapp?ref=fossengineer.com
- https://snapp.li/?ref=fossengineer.com
- https://hub.docker.com/r/uraniadev/snapp?ref=fossengineer.com
Yet Another Url Shortner. A simple excercise to learn Svelte.
version: "3"
services:
redis:
image: redis/redis-stack:latest
volumes:
- /etc/localtime:/etc/localtime:ro
- /home/snapp/redis:/data:rw
networks:
- snapp-stack
environment:
REDIS_ARGS: "--save 60 1 --appendonly yes"
# Optional: Requires `--requirepass mypassword` in REDIS_ARGS
snapp:
image: uraniadev/snapp:0.7.test
ports:
- 3000:3000
networks:
- snapp-stack
environment:
DB_HOST: redis
# DB_PASS:
AUTH_SECRET: # openssl rand -base64 32
networks:
snapp-stack:
external: false