How to Create A Simple Web Server with darkhttpd
Darkhttpd is a light-weight, unsociable-binary internet server daemon for Linux. It delivers a mere “undoubtedly zero config” means to offer off portals as rapid as probable on your server. Here, we manifest you how to mount darkhttpd on Ubuntu Linux, how it edifices upward versus influential-fashioned internet internet servers, and also overview you by means of the strategy of inventing your first site.
- Darkhttpd vs Apache vs Nginx
- Prepping Your Device for darkhttpd
- Posturing and also Sprinting darkhttpd
- Sprinting darkhttpd over SSL by means of stunnel
Darkhttpd vs Apache vs Nginx
Darkhttpd isn’t the simply internet server you can mount on your Linux machine. There are Apache, Nginx, Caddy, Lighttpd and also multiple more. In this stoppage, we’re attending contrast darkhttpd versus Apache and also Nginx and also surf through how it does.
Via alertness to relieve of consumption, darkhttpd beats both Apache and also Nginx outright. Darkhttpd concentrates on storing whatever on a unsociable prospectus. This typicals you can share your site without upsetting about its config and also your mechanism’s init firm.

In specification of wardship, darkhttpd intakes a chroot for its records. It furthermore possesses automated timeouts for idle relationships and also foremost logging. This is a much holler compared to Apache and also Nginx. Both of which have a awesome rate-limiting filters and also selections to unanimously proper-song the HTTP headers on their landmarks.
Darkhttpd’s convenience furthermore lends itself inflexible to custom individual ultimatums. The prospectus’s developers designed it as a rapid means to serve static internet material. This typicals that, compared to Apache and also Nginx, darkhttpd can’t rushed CGI manuscripts or skit as a overturn proxy for your apps.

Style | darkhttpd | Apache | Nginx |
---|---|---|---|
Allay of Application | Requires zero secondary config to host portals. | Requires both mechanism and also site-certain config to job. | Requires site-certain config to job. |
Whole amount Rebuttal | Comes by means of foremost chroot and also logging centers. | Comes by means of rate limiters and also wardship-focused HTTP headers. | Comes by means of rate limiters and also wardship-focused HTTP headers. |
SSL Creativeness | Distinctly no constructed-in SSL demographic. | Comes by means of “mod_ssl” for SSL demographic. | Comes by means of constructed-in SSL demographic. |
Prayer Versatility | Can simply job by means of static internet material. | Can job by means of both static and also vibrant internet material. | Can job as a internet server, considerable amount balancer, and also overturn proxy. |
Nice to realise: position out how information retrieves encrypted on the internet by collecting self-signed SSL certifications by means of OpenSSL.
Prepping Your Device for darkhttpd
Chit: This tutorial is executed on an Ubuntu 24.04 VPS by means of at least 512 MB of RAM. The laws will conceivably job in innumerable Linux distros also.
The first quantify to drifter a site by means of darkhttpd in Ubuntu Linux is to attain the dependences for Docker and also Docker Write.
Chit: The consequent will conceivably mount Docker for Ubuntu-based equipments. If you’re coming from a dissimilar distro, locate out our general overview to mounting Docker in Linux.
Departure by downloading the signing approach for the Docker project:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg
Application your favored text editor to drifter a brand name-influential repository documents:
sudo nano /etc/apt/sources.list.d/docker.list
Paste the consequent jabber of code inside your repository documents:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu noble stable
Reload your machine’s means repositories and also update your totality mechanism:
sudo apt update && sudo apt upgrade
Space Docker, its Write plugin, and also Git making manipulate of proper:
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin git

Posturing and also Sprinting darkhttpd
Surf through your abode magazine, then tug the innumerable recent disparity of darkhttpd to your mechanism:
cd ~ && git clone https://github.com/emikulic/darkhttpd.git
Surf through the inside of the Git repo, then drifter a brand name-influential Docker Write documents making manipulate of your favored text editor:
cd darkhttpd && nano ./docker-compose.yml
Paste the consequent block of code inside your Write documents:
services: darkhttpd: container_name: darkhttpd-website build: context: . dockerfile: Dockerfile volumes: - "./html:/var/www/htdocs:ro" ports: - "8080:80"
Preserve your brand name-influential Write documents, then rushed the consequent command to drifter and also rushed your darkhttpd Docker cyndrical tube:
sudo docker compose up -d
Send out a “html” folder inside the darkhttpd Linux repository, then xerox your static site records to it:
mkdir ./html/ cp -rv ~/my-website ./html/
Attest that darkhttpd is running suitably by list the available canisters in the mechanism:
docker ps

On a side tab: position out how you can ordinance your existing Docker canisters to a brand name-influential mechanism host.
Sprinting darkhttpd over SSL by means of stunnel
At this juncture, you now have a running darkhttpd server at connector 8080. But, to access this over the internet, you need to first encapsulate it in SSL by means of a overturn proxy.
To overture, drifter a brand name-influential DNS “A” record for your domain pointing to your darkhttpd’s IPv4 address. In my husk, I will conceivably juncture my machine’s IPv4 address to the record: “internet.myvpsserver.peak.”
Bring and also mount stunnel, the “core” snap means, and also Certbot to your machine:
sudo apt install stunnel4 sudo snap install core && sudo snap install certbot --classic
If you’re making manipulate of Fedora, you can rushed the consequent command to mount stunnel and also certbot:
sudo dnf install stunnel certbot
Enroll your darkhttpd instance to the Electronic Frontier Substructure:
sudo certbot register --agree-tos -m YOUR-EMAIL@ADDRESS.HERE
Elicit a bare SSL certificate for your domain tag:
sudo certbot certonly --standalone -d SUBDOMAIN.YOUR-DOMAIN.ROOT

Send out a brand name-influential installation documents for your stunnel overturn proxy:
sudo nano /etc/stunnel/stunnel.conf
Paste the consequent block of code inside your brand name-influential config documents:
output = /var/log/stunnel4/stunnel.log cert = /etc/letsencrypt/live/SUBDOMAIN.YOUR-ROOT.DOMAIN/fullchain.pem key = /etc/letsencrypt/live/SUBDOMAIN.YOUR-ROOT.DOMAIN/privkey.pem [https] client = no accept = 443 connect = 8080
Preserve your brand name-influential config documents, then rushed the consequent command to overture the overturn proxy:
sudo systemctl start stunnel4.service

In Fedora, you can rushed the consequent command instead to overture your stunnel overturn proxy:
sudo systemctl start stunnel.service
Attest that your static site is now functioning suitably by opening your subdomain on a internet browser.

Prepping your genuinely own mere site making manipulate of darkhttpd is altogether the first interfere exploring out the magical universe of self-clutching internet services. Learn how you can drifter RSS Feeds for your social media making manipulate of RSS-Footway.
Image credit report: Ilya Pavlov wearing Unsplash. With one voice alterations and also screenshots by Ramces Red.