Hosting a Tor Onion Service (v3) on a VPS

Run a v3 onion service on a root VPS: five torrc lines, localhost-only backends, key backups, client auth. Core lists at $6/mo, $4.80 on the annual term.
Run a v3 onion service on a root VPS: five torrc lines, localhost-only backends, key backups, client auth. Core lists at $6/mo, $4.80 on the annual term.
The address is a keypair, not a server
Nearly everything in server work attaches to a name you lease from somebody else. A v3 onion service inverts that: the .onion string is computed arithmetic, derived from an ed25519 keypair Tor generates on first start, and the machine underneath is interchangeable hardware. Treat the address as a file you own rather than a resource you rent, and several of the classic hidden-service mistakes stop making sense before you get a chance to make them.
The v3 format packs a 32-byte public key, a two-byte checksum and a one-byte version field into the address, then base32-encodes the result into the familiar 56-character string that ends in d. No registry, no certificate authority and no resolver participates in that construction — the machinery described in RFC 1035 simply never runs for this name, which is why no DNS record and no forwarded port is ever required.
Publishing works the same way, one step removed. The service signs a descriptor and uploads it to redundant directory relays; a client fetches that descriptor, learns which introduction points the service currently uses, and builds a rendezvous circuit so the two sides meet in the middle. Your server's IPv4 appears nowhere in any of it — the v3 rendezvous specification defines the whole dance without a single public socket on the host. What lands on disk is small: the HiddenServiceDir holds hostname, the public key and the private key, nothing more.
The typical mistake follows directly from the inversion. Operators copy the hostname file into a password manager, wipe the box during a routine rebuild, reinstall Tor, and watch a brand-new address appear in /var/lib/tor/. The old string still exists — it remains valid arithmetic — but the keypair that gave it an owner is gone, and there is no recovery procedure because there is nothing to recover from. Every published link, QR code and bookmark now points at a ghost.
Everything that follows — five lines of torrc, sockets bound to localhost, frozen backups, client authorization — is detail arranged around this one fact: the identity lives in your files, and the server is only where the files happen to run this month.
VPS from $4.80* — Core on the annual term (list $6/mo), one invoice for 12 months, no auto-charges. Dedicated with IPMI from $39.20/mo. Crypto invoice, no KYC.
Launch nowLocation is an operations decision, not a reachability one
Because no resolver ever consults the rack's address, all twelve facility cities serve a .onion identically well; there is no Tor-friendly flag to chase and no location premium worth paying for reachability. What the flag actually decides is your round-trip while you edit configs late at night, the criminal law that governs the disk, and the invoice multiplier — Reykjavik and Oslo carry x1.2, Zurich x1.35, Luxembourg x1.15, and every other site bills at base list.
Reachability is decided by circuit construction instead. A client assembles a path through three relays to a rendezvous point, the service builds its own three-relay path to the same point, and the pair of paths meets there — six relays end to end, with the rack only ever talking to its own guard. Latency you feel in the browser is dominated by the client's path and the rendezvous hop, not by whether the data center sits in Tokyo or Frankfurt.
So choose by the criteria that survive contact with daily use. Admin latency matters when you push config changes twenty times a week; a European site managed from Europe justifies a European rack on typing time alone. Facility law matters more: Iceland keeps no mandatory data retention, Switzerland runs its own federal data protection act outside the EU, and an EU city puts GDPR case law in reach of any complainant. The Tor Project's onion services FAQ answers the protocol side; the jurisdiction side is your call to make once, in writing, before the first invoice lands.
Where this breaks: operators pick a far-away site for folklore reasons and then pay 180 ms per keystroke for the life of the project, or they relocate the service between countries monthly and wonder why guard rotation makes the address feel flaky. Circuit churn from frequent moves also re-publishes descriptors, which buys nothing and adds startup delay measured in tens of seconds after each restart.
Pick the site once for latency you can tolerate and law you have actually read, then leave the map alone and spend the saved attention on the socket layer, which is where real exposure usually hides.
Five lines of torrc, and none of them is the hard part
People expect onion hosting to be a maze; the actual setup path is a repository, two directives and a reload. The maze is elsewhere — in sockets left world-open, in keys never backed up, in stale packages. Get the five lines right in one pass and the remaining hour of work is hygiene, which is what actually decides whether the service survives its first year. Everything below assumes a root KVM image where you hold the kernel, the package manager and the firewall, because a restricted container will fight you on every one of these steps.
Install from the Tor Project's own repository rather than the distribution's base channel, because daemon features move fast: the introduction-point denial-of-service defenses and modern client authorization require 0.4.3 or newer. Then the minimum declaration is two lines — HiddenServiceDir /var/lib/tor/app/ and HiddenServicePort 80 127.0.0.1:8080 — followed by systemctl reload tor@default, per the systemctl manual. Within seconds the directory holds a hostname file, and the service is reachable through the tunnel even before the application is finished.
Two small declarations earn their place on a service-only box. SocksPort 0 closes the local SOCKS proxy you are not running, which removes an entire listening socket from the audit for free. Pinning HiddenServiceVersion 3 keeps old config files portable across daemon upgrades, and leaving the default of three introduction points is already sane for most launches — raise it only when traffic data, not anxiety, says so.
The classic failure: an operator installs the distro's years-old daemon, writes v3-era directives, and gets a config error that reads like a protocol problem. The second classic: pointing HiddenServicePort at a backend that is not listening yet, watching curl fail, and concluding that the onion is broken when the application simply is not up. Read journalctl -u tor@default before touching anything else; the log states plainly which side of the tunnel refused the connection.
With the daemon current and the two directives in place, the tunnel exists — now the entire remaining project is making sure nothing on the box answers to anyone except that tunnel.
Bind to localhost, or the onion is decoration
An onion in front of an application that also listens on 0.0.0.0 is a locked door hung on an open wall: Tor dutifully tunnels traffic to 127.0.0.1:8080 while the same port answers every scanner that walks the IPv4 range overnight. The tunnel adds a private entrance; it does not remove the public one you left ajar, and nothing about how quietly your traffic flows hides the address printed on the invoice you paid.
Audit the listening sockets first, because they are the ground truth: ss -tlnp should show the application bound to 127.0.0.1:8080 and nothing else on public addresses. If the application cannot bind to a loopback address by configuration, close the port at the firewall with nft so only the loopback path exists. The cleanest fix, where the stack supports it, skips TCP entirely: HiddenServicePort 80 unix:/run/app.sock hands the application a Unix socket that has no network presence at all.
If a clearnet mirror must exist, tell Tor Browser about it: publishing an Onion-Location header on the HTTPS site, exactly as the Onion-Location guide describes, makes the browser offer the onion version to visitors who can use it. The header costs one line in the web server config and moves your most vulnerable readers — the ones who need the onion and did not know it existed — onto the tunnel without a single redirect page.
The false pass to watch for: testing with curl from the box to itself succeeds, so the service is declared sealed, while ss shows the port answering on the public interface the whole time. Staging panels and metrics exporters are repeat offenders — a node exporter on 9090 or a database admin UI bound wide survives every onion migration because it was never part of the tunnel in the first place. Order Core at $6/mo list — $4.80 on the annual term — and keep the entire stack on one small box until real traffic says otherwise.
Once the only entrance is the tunnel, every later decision — keys, defenses, authorization — compounds instead of compensating, which is exactly the position you want the project in.
Back up the key like a credential, not like a config file
The most common irreversible outage in onion hosting is not hardware failure; it is a redeploy that regenerates the keypair. Disk images get rebuilt, /var/lib/tor gets reformatted, and months of published links lose their destination as a side effect of one apt transaction. Hardware dies loudly and is replaced within the hour; a wiped keypair dies silently and takes the address with it, which is a strictly worse combination for you.
Freeze the identity with a deliberate procedure: stop the daemon with systemctl stop tor@default, archive the whole service directory — hostname, public key and hs_ed25519_secret_key — with tar czf, encrypt the archive with gpg per the GnuPG documentation, and store it somewhere that is neither the server nor your workstation's downloads folder. The same archive moves the service to new hardware later — the zero-outage migration pattern starts exactly here. Restore is the reverse path: same directory, same ownership, restart, and the address comes back byte-identical. Set the directory itself to 700 and the files to 600 before the daemon ever starts.
The leak direction is the mirror image and it is worse. Anyone holding hs_ed25519_secret_key can publish descriptors for your address and receive your clients indistinguishably — a clone that needs no DNS hijack and no certificate fraud, because the address is the key. Rotation means generating a new service, publishing the new address everywhere, and burning the old one; there is no revocation list, which is why the backup's storage matters as much as its existence.
Typical mistakes: archiving the hostname file alone, which is the public string and worthless on its own; or committing the key directory into git for safekeeping, where git log preserves it through every later deletion and public-repo crawlers harvest onion keys on a schedule. An encrypted archive on offline media costs you ten minutes; a rotated address costs every link you ever published.
Treat the key trio as the most valuable file set on the machine — worth more than the application, the database and the logs combined — because for the lifetime of the address, that is precisely what it is.
No IP to flood is not the same as nothing to defend
Volumetric attacks have no address to aim at — the rack never binds a public service port, so gigabit-class floods find only the provider's edge, and that is a structural property of the design rather than a filtering product you bought. What remains is quieter and closer to the application: floods of introduction-point requests, rendezvous churn, and CPU exhaustion that arrives one legitimate-looking circuit at a time, billed to you by the minute.
Current daemons ship defenses for exactly that layer. HiddenServiceEnableIntroDoSDefense 1 turns on rate limiting at the introduction point, with HiddenServiceEnableIntroDoSRatePerSec 25 and a burst allowance of 200 as starting numbers to tune against real traffic. Under heavier pressure, the rendezvous proof-of-work defense makes clients pay a small amount of CPU to connect, which prices out floods that were cheap to send and expensive to absorb — the mechanism is specified in the rendezvous specification alongside the rest of the protocol.
Know what the included DDoS filtering does and does not cover: it protects the clearnet IP that your SSH and monitoring ride on, at the datacenter edge, before packets reach you. The onion path never touches that scrubber because it never touches the public interface, so its defenses live one layer up, in the daemon and the application. Budget CPU for the proof-of-work check the same way you would budget memory for a cache — as a cost of serving, not an anomaly.
The mistake runs in both directions. Some operators assume the structural property covers everything, skip application-level rate limits entirely, and meet their first introduction flood with no limit_req zone in the web server, per the nginx module documentation. Others bolt on filtering so aggressive that it treats Tor exit traffic as hostile and locks out the very readers the service exists for. Tune against logs, not against fear.
Defenses on this path are cheap and boring — a flag, two rates, one request zone — and they matter exactly once, on the day traffic arrives that you did not invite.
Client authorization closes the door without opening a port
A private onion — one only listed readers can even resolve — sounds like it needs a VPN, a firewall and a user database. On v3 it needs none of those: descriptor encryption to a list of client keys means unauthorized Tor Browser users fetch nothing at all, and the count of open ports on the box stays at exactly zero. Authorization happens before the first byte of application traffic, so a scanner that was never authorized can never even knock, and you never have to explain that to an auditor.
The mechanics are small. Generate an x25519 keypair for each client; drop the public half into the service's authorized_clients/ directory as a .auth file; give the reader the private half in .auth_private form for their own ClientOnionAuthDir. From then on the descriptor is encrypted to exactly that set, and the service directory shows who is allowed without a single application-level user account being created. The client authorization guide walks the file formats end to end.
Operationally, one keypair per person or per device beats a shared one, because revocation becomes a file deletion and a reload: remove the .auth file, reload the daemon, and the next descriptor cycle locks that client out within minutes. Keep the mapping of key files to humans in the same encrypted store as the service keys, or the access list becomes archaeology within a year and you will be re-issuing credentials you cannot audit.
The common breakage is vintage confusion: HiddenServiceAuthorizeClient is the v2-era directive and does nothing for a v3 service, so configs that mix the two quietly run with no authorization at all. The second failure is client-side — a misnamed .auth_private file produces the same visible symptom as a dead service, and people debug the tunnel when the problem is a filename. Both ends need a current daemon, 0.4.3 or later.
For anything with a billing page, an admin panel or a beta audience, authorization costs less than any alternative and fails closed by design.
The policy layer reads the same on both sides of the tunnel
Anonymity of the address does not relocate the disk. The acceptable-use policy applies to hidden services exactly as to clearnet sites — lawful content only, no CSAM, no phishing, no spam, no attack traffic — and an abuse report about a .onion lands with the host just as one about a domain would. The full reasoning is the offshore legality guide's subject; here the operational takeaway is simply that the tunnel is not a jurisdiction, and no directive in torrc has ever amended a statute.
Abuse handling runs under the law of the facility location, so the flag you picked in the second section is also the statute book your disk answers to. That is not a formality to skim: Iceland reads differently from an EU city on retention, and the locations list publishes each facility's tier, uplink and governing law. Read it once per project, not once per lifetime, because facility law is the one variable in this stack that changes without your involvement and without a changelog entry.
Hygiene on the box is part of the same posture. Keys over passwords on SSH — PasswordAuthentication no in sshd_config, per the sshd manual — dashboards reached through tunnels instead of listens, and one role per machine, because relays and onions age differently and share nothing useful. Moving or rate-limiting port 22 buys quiet more cheaply than any appliance, and none of it touches the onion path at all.
The assumption that quietly kills projects here is that a no-KYC checkout amends the policy layer. It does not: the ban list travels with every plan, and operators who test it lose the box regardless of how the invoice was paid. When a backend outgrows shared CPU, or you want a console that works without the network stack, order Forge at $49/mo list — $39.20 on the annual term — with IPMI on the tier and the same policy attached.
Policy, hygiene and hardware sizing are the same subject wearing three hats: decide them once, in that order, and the tunnel stops being the interesting part of the project.
The onion service, in the order to run it
Run the whole path in one pass and it reads shorter than any description of it. Provision a plain KVM box in whichever of the twelve cities matches your admin latency and your reading of facility law — geography is irrelevant to the address, and the premiums that exist (x1.2 Reykjavik, x1.35 Zurich) are published, not negotiated. You hold root from the first boot, the signup asks for an email or a token, and nothing in the checkout asks for a name at any point.
Second, install Tor from the project repository so the daemon is current, then declare the service: HiddenServiceDir /var/lib/tor/app/ and HiddenServicePort 80 127.0.0.1:8080, reload, and read the hostname file that appears within seconds. Third, close the public entrances: the application bound to loopback or a Unix socket, verified with ss -tlnp, with the firewall dropping anything that still answers on a public address after the change.
Fourth, freeze the identity before you touch anything else: stop the daemon, archive and encrypt the key trio, store it off the box, and rehearse the restore once so the address survives every future rebuild. Fifth, turn on the defenses you will otherwise forget under pressure — HiddenServiceEnableIntroDoSDefense 1 at the introduction points, request-rate zones in the application — and, if the audience is private, client authorization with one keypair per reader rather than one shared key.
Sixth, connect the policy dots: the AUP applies unchanged, facility law governs the disk, and the minimum-data launch checklist covers the layers a tunnel does not — registrar records, payment trails, certificates. Seventh, watch the logs for a week: descriptor publication, circuit counts, introduction traffic, and the application's own errors, because a tunnel that works in front of a broken backend is the most common final state of a rushed launch.
The order matters more than any single step: tunnel first, entrances closed second, keys frozen third, defenses fourth — because each stage assumes the one before it, and skipping a stage converts a five-minute fix into a rebuild with a new address.
Are onion services allowed on VPSbit?
Yes. Tor hosting, onion services included, is an explicitly allowed workload; the acceptable-use policy reads the same for a .onion address as for a clearnet site, and no special permission or abuse deposit is required before you switch one on.
Does the VPS need a special plan?
No. Any plan runs Tor; a small service sits comfortably on the entry tier. High-traffic onions outgrow RAM before CPU, so scale the memory line when you see circuits piling up in the logs rather than waiting for the CPU graph to move.
Can a relay and an onion service share one machine?
Technically yes, but the roles age differently: relays collect abuse mail and bandwidth spikes, while onions need quiet and stability. Separate machines keep one role's noise from contaminating the other, and each can be rebuilt on its own schedule without negotiating with the other.
Where should the onion backend live?
On any box you administer honestly — the address hides the site from the network, not your SSH habits from the machine. Harden sshd, tunnel the dashboards, and if the service ever needs exclusive CPU, the same checkout sells <a href='../../dedicated/'>dedicated servers</a> with IPMI.
What happens if the private key is lost or leaked?
Loss is unrecoverable: the address is arithmetic over the key, so a wiped service directory means a brand-new .onion and republished links. A leak is worse in the other direction — anyone holding the key can publish descriptors and impersonate the service byte for byte.
Primary sources
More ways to pay
Pay with Bitcoin · Pay with Monero · Pay with USDT (TRC-20/ERC-20/SPL) · Pay with Litecoin · Pay with Ethereum · Pay with Solana · Pay with x402 · Pay with Dogecoin · Pay with XRP · Pay with TRX · Monero on bare metal · Dedicated servers with crypto · Pick the jurisdiction first.
Ready to launch?
Build the box — VPS or bare metal — create the password, pay the invoice that follows.