News for hackers. Stuff that matters.
Re:There's never been a better time to build websites by geokon on Monday December 20, 2021 @05:15AM (#29623096)
From reading this I get the sense the problems are lower level and there is no impetus to fix them.

I'm embarrassed to say, having programmed for over a decade, and running Linux for half of that, I still have no idea how to setup my computer to serve a webpage (or even a file)

I probably need to `apt-get install apache` and then deal with some magic config files and incantations and hope I don't mess something up and expose my whole computer to the open web. Then there is the whole mess of NAT (wasn't IPv6 supposed to kill off NATs?).

I need to then figure out the endless (and impenetrable) configurations in my OpenWRT/LuCI router to open a port and have it forwarded to my computer. Or maybe that needs to be done "upstream" in my landlords internet cabinet..? I'd have no idea how to even figure that one out b/c my router doesn't make it obvious in any way.

Then I need to find some DDNS service and figure out how to get that to route traffic from a URL to my IP (and then it's somehow supposed to reconfigure when my IP dynamically changes? Is that some cron job I need to write?)

Hosting webpages from home is still complicated and no progress has been made. And if you do it wrong someone will hack you and steal all your files :) The incumbents are probably happy it's so painful and you still need to do technical gymnastics to punch through NATs and whatnot. This text further confirms it by just telling people to host int he cloud. And understandably.. you'd have to be a total nut to serve a file from your home instead of dropping it on Google Drive.

When I was studying this stuff in college I just figured tech is in an awkward teenage phase and this will all get worked out and streamlined - but I think it's not going anywhere This isn't the tech future of 80s scifi

I don't mean to be wholly negative, I'd actually appreciate if someone pointed me to a good step by step to set everything up. At the moment I'm a sellout :) and I just use Github Pages and git push HTML/CSS files there. Ideally it really should be just as easy to git pushing to your own home computer but till then I guess I'll do that..

Re:There's never been a better time to build websites by alin23 on Monday December 20, 2021 @05:40AM (#29623271)
If opening the 80/443 port is such a nuissance in your setup, I would not bother with hosting from home and I'd just drop the website folder in Netlify Drop (https://app.netlify.com/drop)

That's what I did for the first few iterations of https://lunar.fyi and it really helped with giving people the right information fast while I could keep spending time on the real work (developing the Lunar app)

But if hosting from home is what matters the most, there is an easier way nowadays using Caddy (https://caddyserver.com) and ngrok (https://ngrok.com).

For example, I just hosted this website (https://af62-2a02-2f0e-d00f-e100-f513-b43-fbc1-cf5d.ngrok.io) using the following commands:

    caddy file-server -listen 0.0.0.0:6001
    ngrok http localhost:6001
If you want to go the extra mile and have a nice custom domain, Freenom provides you with a 1-year free domain for the following TLDs:

    .gq .tk .ml .cf. ga
For example, I just registered geokon.gq for 1 month and forwarded it to the ngrok endpoint: http://geokon.gq/
Re:There's never been a better time to build websites by geokon on Tuesday December 21, 2021 @07:04AM (#29636555)
Thanks you for all that! It does look like it simplifies stuff in that there are no more config files! So that's really cool.

I will need to read the docs a bit later b/c from the landing page it's all still confusing. This is probably a function of the tech "debt". It has example commands like

   caddy file-server --domain example.com
- If it's a file server.. shouldn't it be something like FTP/FTPS? Everything on the webpage keeps saying HTTPS .. which is Hyper Text Transfer Protocol.. ie HTML webpages. So is it serving files or webpages? (I guess webpages are a type of file.. but in practice the two aren't the same)

- Do I need to stick this into my .profile? Or I need to configure a systemd service?

- What is it even serving out..? Is it just serving out everything in the immediate directory I'm in where I run the command?

- How is it "hooking into" example.com? How does the registrar know to point at my IP after I run this command? (or if that's done separately - say on the registrar website, why do you need to specify the URL locally at all?)

In any case, these are just immediate questions that come up. It's all stuff that probably makes sense if you know it already :)

And again.. i need to rtfm - so I'm not complaining or shooting the messenger here haha. Thanks for the info

Re:There's never been a better time to build websites by alin23 on Tuesday December 21, 2021 @07:18AM (#29636638)
File server in this context only means a HTTP(S) server that serves static files (which can be webpages like index.html, but not limited to that).

When you run `caddy file-server` in a folder it just starts serving all the files in that folder. You can serve MP3 files if you want, or .txt files, it doesn’t have to be webpages. It just happens to serve them over the HTTP protocol because that’s what the browser speaks.

Keep in mind that caddy doesn’t allow a user to get out of the folder you ran the command in, and it also doesn’t allow the user to list the files in your folder if you don’t explicitly allow that using:

    caddy file-server -browse
For example, I use the `-browse` option to allow users to download any previous release of my Lunar app here: https://releases.lunar.fyi

The domain option is not for pointing that domain to your IP address. That can only be done from your DNS provider (e.g. Cloudflare, or even Freenom which I pointed in the last comment)

What the domain option does is allow you to serve multiple websites on different domains from the same computer, and it also automatically generates SSL certificates for them so that you have encrypted `https://` support by default.

A few years ago, you would have had to buy SSL certificates from someone like Verisign, download those certificates, figure out where to put them securely and configure Apache or Nginx to use them for each domain. Caddy does all that automatically now.

Also keep in mind that if you run a file server like that: `caddy file-server -domain example.com`

… then caddy will only serve those files if you access them using that domain. If you try using your IP address directly, or any other domain instead of example.com, it won’t respond with your files.

In this way you could have multiple domains serving different files from the same computer.

Re:There's never been a better time to build websites by geokon on Tuesday December 21, 2021 @10:21AM (#29638188)
Woah - thank you for taking the time to explain everything. It's challenging to find all the info so concisely in one spot. This has been really useful and educational :)
Re:There's never been a better time to build websites by CraigJPerry on Monday December 20, 2021 @05:54AM (#29623381)
Hey - awesome work on that lunar page, i know it's a landing page and the goal is conversion but it was genuinely enjoyable to read, fun even. Fantastic.
Re:There's never been a better time to build websites by alin23 on Monday December 20, 2021 @05:58AM (#29623408)
Well thanks! Lately I’ve been afraid of the page becoming too information-dense because there are so many features and edge-cases I need to let people know about.

I’m really glad to hear that from you!

Re:There's never been a better time to build websites by stopcraeting on Monday December 20, 2021 @05:46AM (#29623323)
> Hosting webpages from home is still complicated and no progress has been made.

Now this would be a real improvement, not some new framework of the week.

Re:There's never been a better time to build websites by willis936 on Monday December 20, 2021 @07:53AM (#29624340)
Glad to see it isn't just me. I've been doing networking tasks on and off for over a decade and I still fear the nginx config file.
Re:There's never been a better time to build websites by dvdkon on Monday December 20, 2021 @05:28AM (#29623185)
Most of the things you've mentioned are caused by the delayed IPv6 rollout, self-hosting just isn't a priority for residential ISPs. I'm sure that there are plenty of good tutorials on setting up Apache or some other web server, those tutorials can't exist for actually exposing it to the Internet, there's just too many routers and ISPs.
Re:There's never been a better time to build websites by jabroni_salad on Monday December 20, 2021 @11:56AM (#29627007)
If you have python here is a 1liner:

python3 -m http.server

The home networking / dynamic IP stuff will probably not go away until ipv6 becomes more commonplace, but honestly that is for the better. Ask any business whose upnp-enabled receipt printer started outputting antiwork propaganda the past few weeks how it is going.

Re:There's never been a better time to build websites by anderspitman on Monday December 20, 2021 @12:26PM (#29627339)
Spot on. Some of us are working on it. IMO the best solution currently (ie until ipv6 takes over and assuming we get rid of NATs when that happens) is tunneling. I maintain a list of options here:

https://github.com/anderspitman/awesome-tunneling

If you wanted to self-host a website from your home computer today I would recommend buying a domain from Cloudflare, and using Cloudflare Tunnel.

6 months from now I hope to be suggesting some variation of my open source alternative, https://boringproxy.io. It's not quite ready yet.

Re:There's never been a better time to build websites by sprkwd on Monday December 20, 2021 @08:58AM (#29624984)
I found yunohost.org really simple to set up for all my homeserver needs.