Windows (WSL)
Install WSL
Follow the instructions on the official documentation.
The next commands in this guide should be run in the WSL terminal.
Install Deno
sh
curl -fsSL https://deno.land/install.sh | sh
# add ~/.deno/bin to PATH
echo "export PATH=\$PATH:\$HOME/.deno/bin" >> ~/.bashrcSetup Smallweb
sh
curl -fsSL https://install.smallweb.run | sh
# add ~/.local/bin to PATH
echo "export PATH=\$PATH:\$HOME/.local/bin" >> ~/.bashrcSetup Caddy
sh
sudo apt-get update
sudo apt-get install -y caddy
# Write caddy configuration
cat <<EOF | sudo tee /etc/caddy/Caddyfile
smallweb.localhost, *.smallweb.localhost {
tls internal
reverse_proxy localhost:7777
}
EOF
sudo systemctl restart caddy
caddy trustThere is no need to setup dnsmasq on Windows, as it seems to be already configured to resolve .smallweb.localhost domains to 127.0.0.1.
Testing the setup
First, let's create a dummy smallweb website:
sh
mkdir -p ~/smallweb/.smallweb
cat <<EOF > ~/smallweb/.smallweb/config.json
{
"domain": "smallweb.localhost"
}
EOF
mkdir -p ~/smallweb/example
cat <<EOF > ~/smallweb/example/main.ts
export default {
fetch() {
return new Response("Smallweb is running");
}
}
EOFIf everything went well, you should be able to access https://example.smallweb.localhost in your browser, and see the message Smallweb is running.
Start smallweb at login
sh
cat <<EOF > ~/.config/systemd/user/smallweb.service
[Unit]
Description=Smallweb
After=network.target
[Service]
Type=simple
ExecStart=$HOME/.local/bin/smallweb up --enable-crons
Restart=always
RestartSec=10
Environment="SMALLWEB_DIR=$HOME/smallweb"
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable smallweb
systemctl --user start smallweb