Asklemmy isn't really a place to ask about lemmy, it's for asking general questions to users of lemmy, jut like you wouldn't ask for Reddit support in /r/askreddit.
Regardless, this question gets asked and talked about in the !selfhosted@lemmy.world community fairly often, here is a (slightly edited) comment I made a while back.
You will need a domain name, you can buy one from a registrar such as hover or namecheap (for the love of all that you consider holy do not use godaddy).
You will need a way to expose the server that you set up via port forwarding or similar on your network.
You will need to set up DNS records on the domain you buy to point to your home IP. You may want to figure out a different way to avoid just handing that information out, cloudflare can help with that. You will want to make sure the DNS records get automatically updated if your IP address changes, which is not uncommon for residential ISPs.
You will need to figure out how to get an SSL certificate, Let’s Encrypt will issue them for free, cloudflare gives you one if you use them as a reverse proxy.
Some of this would likely be easier to do on a cloud provider like digitalocean or linode and could be done reasonably cheaply.
These are all common things for setting up any website, so lemmy docs won't cover them. In addition to those (this answer was just addressing "how to get a URL") you will need to install and configure lemmy, lemmy-ui, postgres, and pictrs somewhere (the join-lemmy docs cover this well).
If you want your instance to send emails you will have to figure out how you want to do that (too many options to cover in this answer).
When 0.18.1 gets released if you want captcha you'll probably have to figure out an mCaptcha provider or set that up yourself.
Not to mention thinking about backups, high availability, etc, etc.
As far as hardware to host on you could get away with like ~$10/mo on most any cloud provider, run it on a Mini-PC in your closet, etc. My instance uses 1-2 GB of RAM, ~13GB of disk (and growing), and ~30% of a CPU (an old i5).
Best of luck.
Traefik. It has a GUI that I can use to see things, and (depending on your setup) you define the routes and stuff as part of your container definitions, minimal extra work required, makes setup and teardown a breeze. It is also nice that you can use it in all sorts of places, I have used it as Kubernetes ingress and as the thing that routed traffic to a Nomad cluster.
I went from Apache to Nginx (manually configured, including ACME) to Traefik over the course of the past ~10 years. I tried Caddy when I was making the switch to Traefik and found it very annoying to use, too much magic in the wrong places. I have never actually used NPM, as it doesn't seem useful for what I want...
Anyway, with traefik you can write your services in docker compose like this, and traefik will just pick them up and do the right thing:
It will just work most of the time, though sometimes you'll have to specify
'traefik.http.services.foo-example-com.loadbalancer.server.port': whatever
or other labels according to the traefik docs if you want specific behaviors or middleware or whatever.And your deployment of traefik would look something like this:
Note that you'd have to create the
traefik-expose-network
manually for this to work, as that is how traefik will talk to your different services. You can get even fancier and set it up to expose your sites by default and auto-detect what to call them based on container name and stuff, but that is beyond the scope of a comment like this.Technically my setup is a little more complex to allow for services on many different machines (so I don't use the built-in docker provider), and to route everything from the internet using frp using proxy protocol so I don't expose my home IP... I think this illustrates the point well regardless.