Author Topic: Raspberry Pi 4B as Web Server  (Read 4397 times)

0 Members and 1 Guest are viewing this topic.

Offline galfert

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 6822
Re: Raspberry Pi 4B as Web Server
« Reply #25 on: January 25, 2021, 11:35:56 PM »
Gosh I don't know if I can be the best source of information for that. I'm likely to forget to mention something. So don't just go by what I say. I think you should research and learn as much as you can from multiple sources. It's kind of like researching a cooking recipe for something your never made. There is more than one way that I know to do this.

So, you look up various recipes and find the one that sounds more like you think you'd like. But often there is no perfect recipe so what you end up doing is borrowing a little from various recipes and then coming up with your own new recipe.

But in essence these are some basic summary steps...

- get a static IP address from your ISP or configure a dynamic DNS service on your home router.
- I recommend also configuring a Let's Encrypt certificate to do HTTPS but you can skip this and do it later and just focus on HTTP for now.
- on router open and forward TCP ports 80 and 443 to your internal server (Raspberry Pi)
- ensure that your server is not blocking these ports
- Go to GoDaddy Domain Manager and go to DNS management for your domain. Create CNAME record and call it what you want, like "weather" and point it to your Dynamic DNS registered service name. This then has the effect so that the full CNAME URL is weather.yourdomain.com for example.
- if you have a static IP you can instead create an A record to point to your static IP. This A record can be weather like my previous example. Or you may want to direct the entire domain by editing the A record for @ and pointing it to your static.
- then as long as your web server is configured to listen correctly it will then serve up what you've configured on the server.
- for further security and management you can also configure a reverse proxy (optional).
« Last Edit: January 25, 2021, 11:45:02 PM by galfert »
Ecowitt GW1000 | Meteobridge on Raspberry Pi
WU: KFLWINTE111  |  PWSweather: KFLWINTE111
CWOP: FW3708  |  AWEKAS: 14814
Windy: pws-f075acbe
Weather Underground Issue Tracking
Tele-Pole

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #26 on: January 25, 2021, 11:46:52 PM »
Ouch! There's a bit more to this than I thought there would be.
Yes, I also need to do some reading and research.
I need to understand what I'm doing.
And I sure don't right now.
As usual, Google is my friend.
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline davidmc36

  • He who dies with the most toys wins!
  • Forecaster
  • *****
  • Posts: 1246
  • FN25ie61jw
    • MorewoodW34
Re: Raspberry Pi 4B as Web Server
« Reply #27 on: January 26, 2021, 12:21:25 AM »
That is just what I did. All seemed to go fine with the instructions I linked up-thread.

There was one stumbling block about permissions to write files on The Pi that I found near the end but all the info was there.

If you search my posts you should find some comments about latest set up. I think maybr the thread where Wojtek asked for Beta testers.

It couldn't get any better than this, David.
W34 is exactly what I want to run on my website.
Your site with W34 really looks great!
I've purchased loganvilleweather.com
Are you running on RPi 4B ?

In actual fact. The W34 is being fed by Meteobridge.

This one here that I do not publish elsewhere is running off MeteoPi and a ZeroW:

http://www.morewoodweather.ca/CumulusMX/index.htm

My other Pi Zero is set up with WeeWx and Apache for the new Logger.

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #28 on: January 26, 2021, 01:08:33 AM »
David, your ISS battery has a red X and says "replace".
« Last Edit: January 26, 2021, 01:15:03 AM by TraderGary »
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline davidmc36

  • He who dies with the most toys wins!
  • Forecaster
  • *****
  • Posts: 1246
  • FN25ie61jw
    • MorewoodW34
Re: Raspberry Pi 4B as Web Server
« Reply #29 on: January 26, 2021, 07:53:19 AM »
David, your ISS battery has a red X and says "replace".

There is no battery in a wired ISS.

I could probably take that tile out of the 34 template.

But it will get used when I put the wireless board into it.  Summer......ish  :roll:
« Last Edit: January 26, 2021, 07:57:32 AM by davidmc36 »

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1308
  • BismarckWeather.net
    • BismarckWeather.net
Re: Raspberry Pi 4B as Web Server
« Reply #30 on: January 26, 2021, 09:07:35 AM »
The hard part about using the home server is you either need to get a static IP from your ISP.  Or you can use a Dynamic DNS service, which is what I do.

I have a NO-IP free account.  I have software on my router that updates my No-IP registered name every hour or so.  It could be less, I don't honestly recall.  So that way if my home IP address changes, my name on No-IP is updated with the new IP address.

Then in GoDaddy, I added a record of "broadcast.bismarckweather.net" and pointed it to my No-IP DNS name.  I'm using sub-domains at home.  But I don't see why you couldn't use your main site.   At least you could get your home server all tested out using the No-IP name and only flip over when ready.

In the case of a sub-domain, I just added a CNAME record of broadcast.bismarckweather.net and pointed it to my thezastoupils.servebeer.com name from NO-IP.

One other consideration is you may want to read up on getting SSL certs on which ever web server you are using.  Try to plan ahead and be ready to do it.  You could install CertBot I believe and set it up to renew your certs automatically.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 836
  • #conligwx
    • conligwx.org
Re: Raspberry Pi 4B as Web Server
« Reply #31 on: February 02, 2021, 03:17:15 AM »
you need to point the DNS servers in your domain registrar to the IP address where your webserver is.  if you do not have a Static IP, then go with a DDNS solution.

my domain conligw.org is registered with google domains, they also provide DDNS(same protocol as DYNDNS) and also support DNSSEC without any extra charge.

usually most home Routers support a DDNS protocol, and this is what registers your Dynamic IP to the DDNS service/domain name.
« Last Edit: February 02, 2021, 03:19:35 AM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


Offline ConligWX

  • Forecaster
  • *****
  • Posts: 836
  • #conligwx
    • conligwx.org
Re: Raspberry Pi 4B as Web Server
« Reply #32 on: February 02, 2021, 04:16:34 PM »
Just make sure to install SSL cert on router if using DDNS. Cannot really recommend using DDNS on home router esp. without installing SSL cert. Even if you install SSL cert. you also need https authentication method to do this & it needs an https LAN port (create another opening though encrypted).

my cert is on my Webserver. not the router.  the router only passes traffic for opened ports. ie port 80 and 443. these then forward to the webserver IP/cert and thus https works. 

I'm not understanding you comments regarding installing the cert on the router. or not using DDNS on a home router, thats what DDNS was designed for since most home users have dynamic IP addresses that change when the ISP feels like it.  DDNS ensure the Domain DNS entries point to the correct IP address at all times.

I also run zbblock for malicous php code on my webserver, and have IDS enabled on my UDM Pro.

Regards Simon
Davis Vantage Pro2 Plus (6162UK) • Daytime FARS • WeatherLink Live • AirLink • PurpleAir PA-II-SD • CumulusMX •


 

anything