pkulchenko / fullmoon

Fast and minimalistic Redbean-based Lua web framework in one file.
MIT License
677 stars 29 forks source link

Any help with DNS/virtual hosting/ip address? #13

Closed tommaisey closed 1 year ago

tommaisey commented 1 year ago

I'm aware this isn't the proper forum for this issue, but I don't know of any redbean-specific forum or discussion area and I'm at my wit's end with this. I'm making a website for my wedding invitations, and I've got my fiance impatiently waiting, and questioning my skills, which won't do at all!

I've had enormous fun making a tiny/simple web app with redbean/fullmoon, but I've never done this before and I'm stuck at the final hurdle. I have rented a DigitalOcean VM ('droplet') and purchased a domain name. I pointed the domain at DigitalOcean's nameservers and created an 'A' record pointing at the VM's IP address. The VM is running an instance of redbean/fullmoon listening on port 8080.

Now when I visit the domain name ('http://ournames.wedding') I am redirected to the IP address - i.e. I now see http://42.42.42.42 in the address bar. All I want is for that to remain http://ournames.wedding. But I've been trying different things for days and I don't even know what I'm trying to accomplish!

The server's running Ubuntu 18.04 if that's relevant. I'm posting this from here because the only information I can find online suggest fiddling with Apache's VirtualHosts file or doing some Wordpress config, which suggests it needs to be solved at the app level. And I have no idea what to do with redbean/fullmoon. Any help would be most gratefully recieved, and I will of course close this issue immediately.

pkulchenko commented 1 year ago

@tommaisey, there may be several things to check. First of all, you appear to be running redbean/fullmoon on port 8080, but are trying to access your domain on port 80. You need to be running redbean on port 80, which will require setcap command to give it privileges to connect to port <1024 after you assimilate redbean: ./redbean.com --assimilate; sudo setcap 'cap_net_bind_service=+ep' ./redbean.com; ./redbean.com -p 80.

Also, you can try to run commands like wget or curl to check if there is any redirect from the domain name to the port address being issued. There is nothing in redbean or fullmoon code that would issue a redirect like this (to my knowledge). If you want to send me the back-end code to check on what's going on, you can email it to my address in github profile.

tommaisey commented 1 year ago

So I discovered an odd thing - I had originally set the domain up in GoDadday to 'forward' (whatever that means) to the.ip.addr:8080. Since then each time I visit in Firefox I got redirected there (with the 8080 port), even after I moved the nameservers and made a new A record (48 hours ago) that didn't mention the port. So I had tried moving to port 80, but that didn't work as I was still being directed to 8080.

This morning I tried visiting in Chrome; I wasn't redirected to port 8080. So then I tried starting the server listening on port 80 according to your suggestion and it works! I think there must have been some DNS caching going on in Firefox that's been confusing the whole situation for the last few days.

Thank you so much! Your suggestion about curl (which didn't show up any port) led me to figure this out. I can finally get these invitations out, which will delight my fiance.

And thank you for creating fullmoon! It's such a delightfully simple way to make a web app.

pkulchenko commented 1 year ago

Sounds good; thank you for the update! Let me know if you run into any other issues.