Self-hosting

Revision as of 14:23, 29 October 2025 by Akshay (talk | contribs) (fundamentals of self-hosting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When you host a web-based software on your own (self), it is called self-hosting. It could be a simple HTML website, a dynamic PHP blog, or a distributed social network.

Typically "self" refers to configuration of the software (operating system, packages, database, and so on) alone and the physical server is operated by a cloud provider like AWS, DigitalOcean, or Hetzner. But some people self-host on computers they physically control, in their home or office.

Elements of self-hosting

Networking

When you self-host a service, you have to ensure the users/clients are able to reach the service. This requires networking to be setup correctly.

You would typically need a domain name. A domain name (like fsci.in) is purchased via a registrar (like NameCheap, Gandi.net) for (mostly) about ₹1000-1500 per year. The registrar puts your (registrant) details in the registry (which is typically operated by countries or very big companies). And once this is done, you become the proud owner of the domain name. The registration will have to be annually renewed (unless you registered for multiple years). All of this process is overseen by ICANN.

When you register a domain (say, fsci.in), you are automatically in charge of all subdomains (wiki.fsci.in, videos.fsci.in, meet.fsci.in, etc) and these do not require further registration with the registry. How do you configure these then? That's where DNS comes in. DNS allows you to specify which server your domains and subdomains should be connected to.

You can, for example, have fsci.in pointed to 35.185.44.232 with a DNS 'A' record and have wiki.fsci.in pointed to 135.181.250.25 with another DNS 'A' record. That means, when someone types in fsci.in on their browser, the browser will connect to the IP address 35.185.44.232 which will connect it to a server on the internet with that particular IP address. And similarly when someone types in wiki.fsci.in the browser will connect to a different server, the one with the IP address 135.181.250.25.

Note: DNS has many types of records. A records are not the only type.

Server

The word server has two meanings. It can denote the computer that's running your services (for example VPS, i.e., Virtual Private Server), it can also mean the software that's running your services within your server (example: Caddy, Nginx, Apache).

When you are self-hosting using cloud servers, you would have to purchase a server by paying the service provider (starting from about ₹300-500 per month). The provider (AWS, DigitalOcean, Hetzner, etc) would then run a (virtual) computer in their data center for you. They will ensure that this computer never shuts down, is always kept cool, and is always connected to the internet. They will also provide an IP address for this server. (This is the IP address that you put in your DNS records).

When your service provider creates the server, they will also install an operating system of your choice (like Debian, Ubuntu, CentOS) on that server. You will be expected to log-in using SSH and configure the server to your liking — installing packages, updating the operating system, editing configuration files, etc.

Once a user's network request reaches your server, the server software you install (like Caddy, Nginx, Apache) can respond to it based on how it is configured. For a simple HTML site, you typically do not need any additional software and your server software can directly respond with the HTML file from the configured folder. For more complicated services, your server will typically talk to a different software to get the response which eventually gets sent to the user.

Software

Examples of web-based software include WordPress (for blogging), MediaWiki (for wiki), Loomio (for decision making), Prosody (for XMPP instant messaging), NextCloud (for file sharing) and any React/NodeJS/Vue/NextJS/Django/Java/Rails/Flask/etc web projects that you build. Each of these differ in how they are installed and run and you would have to rely on the documentation specific to the software to figure out how to run the service.

Many software projects use Docker as a uniform way to deploy their software on any operating system. Therefore, many software documentation will ask you to install/run their software using docker. In such cases, there is also often a Docker Compose configuration they recommend which helps with deploying the software and other components it depends on (like the database).

Database

Most software store important data in a different software – the database (eg: mysql/mariadb, postgresql, sqlite). Some software support using any database software, some require a specific database software.