10
h4xx3r
7y

!rant
How to self host a website?
Seriously, through many guides out there, I was never been able to see my site (hosted on a raspberrypi with nginx) outside the local network. I always tried to link my router to no-ip without success outside my localhost, the port 80 is already open for the raspberrypi. I live in Italy, can it be that the local ISPs obstacle the creation of such homemade website hosts?

Comments
  • 2
    Why not github pages?
  • 3
    Self hosting is pointless these days. There are so many cloud services which do it for you at little/no cost. Who wants to manually manage webserver daemons and SSL certs? Nobody.
  • 7
    @globalvariable you could always use Let's Encrypt for your SSL! I do agree with your point, though.
  • 5
    @hacker LE is the best thing to happen to SSL since its invention 👍
  • 0
    @jaread @globalvariable because later on I would like to host a webservice with mvc and data collection in a database. But if I can't get past the normal site exposure to the web, I fail on the later.
  • 1
  • 2
    @thepra Then use Heroku or Elastic Beanstalk or something. If you can't figure out how to set up a simple http server, you probably don't have a good grasp of networking and/or linux, and your site would get owned in no time at all by script kiddies (and you'd never even know about it).
  • 1
    @globalvariable me. Part of the sysadmin job ain't it? ;)
  • 6
    Just spin up a DigitalOcean account.

    $5/ month and it takes all your worries away from having a self hosted and unless you know what your doing highly vulnerable server.

    Throw let’s encrypt on and you now have renewable ssl for $0.

    Most expensive part of the whole setup is your domain name.
  • 1
    @C0D4 I would like to learn and understand the independent way of implementing webservices. I do already have a payed domain+host+db and a github website. I would like to be outside of any service provider.
  • 1
    Do you have your own public IP-address? At least in here, ISPs offer it as an extra service (usually inexpensive) but for hard line it might even come by default, at least used to. I couldn't find anything to test if you are behind a NAT except this: https://ip.bieringer.de/cgn-test.ht... . Looks like a good mesure to test it, though couldn't do it on my phone for some reason.
  • 0
    @joas nope, all of Italian carriers offer dynamic ip out of the box, that's why I link my modem to no-ip, so it can receive from the modern the dynamic IP. Thanks for the link, let's try...
  • 0
    @joas no protocol testable error ._.
  • 1
    @thepra I don't think DynDNS tunnels your traffic. I though it's just system to automatically refresh dns records to point to your IP when it changes.
  • 2
    So in NAT, one IP is routed to multiple IPs, like in your home router. That kind of routing blocks incoming traffic unless forwarding is defined to sub IP. Remember we are talking in ISP level not local network. You can buy a service from ISP to bypass their NAT and have your own IP where your network is found, not anyone elses. This doesn't mean your IP doesn't change, it probably does but not as frequently as with NAT. I think static IPs are no longer given to individuals, because IPv4 is running out of IP-addresses. There's where dynamic DNS comes handy.
  • 0
    @joas this public IP looks the same as the one given on whatsmyip.org , I don't think I'm under NAT
  • 0
  • 1
    @thepra
    Since your going down this path, kudos for persisting 👍.
  • 2
    @C0D4 thanks. From I've tried and seen, the path isn't the easiest. But I'm kind of a hard head, I'll bang my head around a problem until I achieve something working the way I want 😅
  • 1
    @thepra Ok, though your router shows that's the public IP and might not be the IP thats assigned to the router, but it also could be that you are not behind NAT. In that case: congratulations and happy troubleshooting.
  • 3
    @thepra
    If you can get port forwarding on your router to go from external to local ip + port 80 / 443 ( depends on router, usually called virtual hosts / port forwarding setup ) you will be able to forward requests through to local server.

    Once you have that working (unless your behind a NAT) you will need to look at DynDNS or similar to redirect a domain through to your external ip.

    Then go jump on as many sites as possible to learn about securing your server and network.
  • 1
    @C0D4 http://79.45.16.145/
    I've installed a lightweight webserver for Windows, as you can check, on that ip address you'll find the default page of that webserver. Can you confirm?
  • 1
    @thepra

    Welcome to Abyss Web Server

    Looks like you made it that far 👍
  • 1
    @thepra Oooh, yes. Good job.
  • 0
    @C0D4 @joas
    It's a relief knowing that I'm not blocked. Now I can start trying to make it work with nginx on the raspberrypi. In which I failed last time >_>
  • 1
    @thepra
    Living in Italy and got the same ISP. As far as I know Telecom Italia always provide you with a public IP address, though not static. Your router is always reachable from the outer world. You just have to configure port forwarding properly.
    I see you got the thing done, congrats! I run a self hosted server myself and that's the way you learn ;)
    Now that your server is reachable from outside LAN you should also be concerned with security.
  • 1
    Once I self hosted a site using xamp and some commands in CMD. It actually worked outside my local network. Anyone who wanted to access my website had to use my ip and it was dynamic so it kept changing but this was nearly 4 years ago when I was going school. Can't remember the commands now. But I did it by following a tutorial. Use Google, if you can't find it means you gotta dig deep down.
  • 2
    @ebourgess what's he supposed to elaborate on? I see everything answered accordingly lol
  • 2
    @thepra doing it yourself first is a rite the passage.

    I usually hook the device that is hosting up to the dns instead of the router.
  • 1
    Lucky you, I have Fastweb, and they're absolute shit because the router is not directly exposed to the internet, but goes through their subnetwork first, meaning that I can't directly expose a site to the internet :(
  • 0
    @moortuvivens can you elaborate how does it work? Why it's convenient?
  • 1
    Idk this one tbh :/ @ebourgess
  • 0
    @endor I can understand you, in another location I have fastweb too, and even if I got a public IP, I didn't made it work outside of localhost
  • 1
    @thepra yeah, from what I've gathered you'd have to set up a reverse NAT in that case, otherwise you're only exposing your router to their internal network
  • 1
    @thepra its been to long.
    Ill set my stuff up tomorrow and I'll get back to you.
  • 3
    If I understood what @moortuvivens meant, I've done the same with my self hosted website. I've got a domain registered with Namecheap and use ddclient, running on the same raspberry hosting the website, to update the DNS field. I had to set very short TTL in order to avoid caching.

    @endor
    I know you can ask for a public IP for free, a friend of mine did it a year ago in order to reach his home network with SSH and host web services.
  • 2
    @Balzy thanks, I'll look into it
  • 1
    I own a website with its own domain hosted through digital ocean. It's not that hard honestly. Ssh into the server (Ubuntu 16.04), set up projects , smtp necessary private files, spin up project (I use more + pm2), set up A and CNAME on digital ocean, set up digital ocean name servers on domain provider, wait. It took a while to understand what exactly was going on, and I don't 100% still (I am noob), but hey it's running and I feel like that's nifty.
  • 1
    I think I did have to find a command online and go set up the server file thing and give it my domain name so it'll run on port 80, that part was a huge hassle and I have no idea how or why it worked but it did.
Add Comment