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

0 Members and 1 Guest are viewing this topic.

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Raspberry Pi 4B as Web Server
« on: January 24, 2021, 12:56:50 PM »
I recently purchased a CanaKit Raspberry Pi 4B, 128GB SD, 8GB Memory.
It's a nice kit with everything needed and a nice case with a fan.
I figured why not max it out for the small extra cost.
You can never have too much storage and processor memory.

After a lot of learning and work I have it running totally headless on my Windows 10 PC using RealVNC VNC Connect.
I also have ssh Linux command line control using windows PowerShell.
The only physical connection to the Raspberry Pi 4B is the power cord.
VNC even has a fully functional Android app!

Has anyone here set up an Apache Web Server on their Raspberry Pi?
Experience, advice, and help will be very much appreciated.
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7552
    • Eagle Bay Weather
Re: Raspberry Pi 4B as Web Server
« Reply #1 on: January 24, 2021, 12:59:24 PM »
I've done this several times.  For various applications, too.  Example: https://randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server/ 

Be sure you back up EVERYTHING!!!  It is a bit of work to recreate it, so clone your final  set up before you go to production phase.
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline davidmc36

  • He who dies with the most toys wins!
  • Forecaster
  • *****
  • Posts: 1120
  • FN25ie61jw
    • MorewoodW34
Re: Raspberry Pi 4B as Web Server
« Reply #2 on: January 24, 2021, 01:24:10 PM »
I have done this twice:

http://weewx.com/docs/usersguide.htm

Sitting on a 128GB SD and a Zero waiting for a logger to test.

The Apache server seems to set up pretty easy from the steps.

Offline bchwdlks

  • Senior Contributor
  • ****
  • Posts: 188
Re: Raspberry Pi 4B as Web Server
« Reply #3 on: January 24, 2021, 08:03:45 PM »
TraderGary,
After you get the Apache set up & functional,  use your RPi to control the webcam.  The RPi is the easiest by far for taking the images,  resizing to meet size/shape requirements and over laying your weather data onto the image.

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7552
    • Eagle Bay Weather
Re: Raspberry Pi 4B as Web Server
« Reply #4 on: January 24, 2021, 10:03:37 PM »
TraderGary,
After you get the Apache set up & functional,  use your RPi to control the webcam.  The RPi is the easiest by far for taking the images,  resizing to meet size/shape requirements and over laying your weather data onto the image.
Yup!  Imagemagick is da bomb for this.
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #5 on: January 25, 2021, 12:10:53 AM »
Anybody using their Raspberry Pi as an email server?
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7552
    • Eagle Bay Weather
Re: Raspberry Pi 4B as Web Server
« Reply #6 on: January 25, 2021, 10:13:38 AM »
Anybody using their Raspberry Pi as an email server?
Why?  I've done this on a PC, but see no need to set up a separate server that could be compromising your network.
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #7 on: January 25, 2021, 10:32:31 AM »
Years ago I used to run my own web and email server 24/7. When the hardware failed I looked at the then low price of GoDaddy for being my web and email server. I've now used GoDaddy for well over 20 years. The price is now nearing $200/year. I want to continue to maintain and use my distinctive email addresses and have full control of my email server. If the Raspberry Pi 4B can handle it, I would like to do it.

Why do you say that doing that could compromise my network? Should I not trust the reliability and capability of the Raspberry Pi 4B? I'm running my RBPi4B on my routers UPS and it runs 24/7 reliably so far.
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline galfert

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 6822
Re: Raspberry Pi 4B as Web Server
« Reply #8 on: January 25, 2021, 10:47:29 AM »
I would not recommend running your own email server at home for the following reasons.

- You have several single points of failure. One server device, one router, one ISP connection, one power company. Sure you can sort of mitigate if you have adequate UPS, and maybe even a whole home generator, but still too many single points of potential failure, unless you go full boat with cluster servers, redundant power supplies, and dual ISP services, and complex redundant enterprise networking, but there is still every else listed below.
- having your own domain for email has lost its cachet over the past decade or so. Unless you operate your own business I see no need. It's actually a downgrade (I'll explain - next bullet points)
- You'll lose the integration services of having a gmail, or hotmail account.
- You most likely are going to need a gmail or hotmail account anyway or both to use available online services.
- You have to keep up and maintain the darn thing, patching security vulnerabilities...etc.
- You reduce the likelyhood of your sent mail delivery success unless you know how to properly configure things like DMARC, and SPF.
- A potential problem to also have to deal with dynamic IP address, SSL certificates..etc.
- Running an Email server is easy....but good Spam protection isn't and that part is very important.
- IMAP stinks and POP3 is even worse...and those are your options when you run your own email server, unless you splurge for MS Exchange which is nuts.

« Last Edit: January 25, 2021, 12:41:44 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 #9 on: January 25, 2021, 12:05:02 PM »
I would not recommend running your own email server at home for the following reasons.

- You have several single points of failure. One server device, one router, one ISP connection, one power company. Sure you can sort of mitigate if you have adequate UPS, and maybe even a whole home generator, but still too many single points of potential failure.
- having your own domain for email has lost its cachet over the past decade or so. Unless you operate your own business I see no need. It's actually a downgrade (I'll explain - next bullet points)
- You'll lose the integration services of having a gmail, or hotmail account.
- You most likely are going to need a gmail or hotmail account anyway or both to use available online services.
- You have to keep up and maintain the darn thing, patching security vulnerabilities...etc.
- You reduce the likelyhood of your sent mail delivery unless you know how to properly configure things like DMARC, and SPF.
- A potential problem to also have to deal with dynamic IP address, SSL certificates..etc.
- Running an Email server is easy....but good Spam protection isn't and that part is very important.
- IMAP stinks and POP3 is even worse...and those are your options when you run your own email server, unless you splurge for MS Exchange which is nuts.

Yes, you're right.
I do have one advantage at GoDaddy. I'm grandfathered in with "myownname.com" email account. They don't do that anymore unless you pay big bucks for a corporate account. I'll just leave my email set up the way it has been for the last 20 plus years using GoDaddy and Microsoft Outlook.


However I do still plan to use Raspberry Pi to run my own web server and have my weather page on it.
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline galfert

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 6822
Re: Raspberry Pi 4B as Web Server
« Reply #10 on: January 25, 2021, 12:33:40 PM »
However I do still plan to use Raspberry Pi to run my own web server and have my weather page on it.

And that is reasonable, as a personal website does not need four nines uptime. You can keep your MX records pointed at GoDaddy and then point your A and AAAA records to your personal website with the same domain name.
Ecowitt GW1000 | Meteobridge on Raspberry Pi
WU: KFLWINTE111  |  PWSweather: KFLWINTE111
CWOP: FW3708  |  AWEKAS: 14814
Windy: pws-f075acbe
Weather Underground Issue Tracking
Tele-Pole

Offline DaleReid

  • Forecaster
  • *****
  • Posts: 1903
    • Weather at Eau Claire, WI
Re: Raspberry Pi 4B as Web Server
« Reply #11 on: January 25, 2021, 02:28:01 PM »
TraderGary:
If you have an email address, can you somehow host it with a web server as you are indicating in one of the reasons you want to retain control?

I thought some big sorter-outer pointed email traffic to some place that ended in "...@Name.com" or whatever and that the Name.com was purchased by someone who tells the mail handlers to send it to them.

All this is a bit of a mystery to me, but for instance, if I had Name@charter.net I couldn't wrest that address away from charter.net since they own that or at least paid big bucks for that.

I have a friend who many years ago lost out of claiming his last name as '@lastname.com' so he could have had "Firstname@lastname.com" and "WifesFirstName@lastname.com"

I see that there are a lot of places that own the .com that matches a bunch of last names and sells their email service to you if the firstname isn't already taken, of course.

I'm not sure if they provide a real email service, or just translate or direct the name to another account you own.  I have this from an ancient account, who's @eau.net suffix has been sold a couple times.  Now very few of us remain, but I cannot get the current company to release my whole address, saying they are all tied together.

One of the mysteries of the universe.  I guess I'd expect such things as email name portability to work just like your cell phone number can be literally anywhere in the country now.

Just an interesting branch of this internet stuff.
Dale
ECWx.info
&
ECWx.info/t/index.php

Offline galfert

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 6822
Re: Raspberry Pi 4B as Web Server
« Reply #12 on: January 25, 2021, 04:25:00 PM »
Dale,
I'll try and clear up your questions and try and remain as least technical as possible...

Everything after the @ sign in an email address is a domain name. If you or a company purchases a domain name then you can form email addresses using that domain name at will.

When you get an email address from a provider that owns a domain like...eau.net or gmail.com or hotmail.com...aol.com then all those email addresses are controlled by whomever owns the domain. If they gave you the email for free they can continue to provide you with that email service but do realize that there is no guarantee that it will work forever if they decide to take down the email server. There is nothing you can do to take ownership unless you purchase the entire domain which then gives you control of every email address under that domain.

The phone number analogy does not really apply. You don't become your own phone company. You can port your number from one company to another but ultimately a phone company owns that number...stop paying for that service and you'll lose the number...you don't own the number in the sense that you think you do. Regardless email works completely differently.  As I mentioned email addresses stem from a domain. And any domain can only have one owner.

If you want to control your own email domain...then you just buy a domain name... Whatever.com....or Whaterver.net....etc. After you have ownership of the domain you have to pay every year to maintain that registration with one of many domain registrars. Whatever domain registrar you purchase the domain from doesn't necessarily dictate where the email for the domain is handled. It is up to you do define within the registry where the email server is. You can pay the domain registrar if they are a hosting company also for email hosting...or you can run your own email server and point the registration records to the IP address of your own email server or to your own web server (which could be the same or different IP addresses for the same domain because email and web are different configurations within the domain settings). If you don't like the domain registrar you can move the domain registration to another registrar...but just because you move the registration does not necessarily mean that the email or web server becomes a different IP address...as these are separately configured options.
Ecowitt GW1000 | Meteobridge on Raspberry Pi
WU: KFLWINTE111  |  PWSweather: KFLWINTE111
CWOP: FW3708  |  AWEKAS: 14814
Windy: pws-f075acbe
Weather Underground Issue Tracking
Tele-Pole

Offline DaleReid

  • Forecaster
  • *****
  • Posts: 1903
    • Weather at Eau Claire, WI
Re: Raspberry Pi 4B as Web Server
« Reply #13 on: January 25, 2021, 04:56:03 PM »
Galfert:

A most educational explanation of the subject, and I thank you.

Indeed it clears up misconceptions I have and reinforces ideas that I had of how it probably works.

I was particularly interested in your discussion of how a rented, not owned as you point out, domain name gets email serviced. 

I assume the registration of the domain points to a particular IP address where the software and server takes care of all the niceties of making email work.

My weather page is at Ecwx.info, and I have an email (which I almost never check, but should) attached to that.  I never told the registrar of domains what my IP address is, but have GoDaddy do the hosting, and they must have alerted the servers which steer requests for access (are these the DNS ?) of a look up of where to send incoming and request info from my server, or the email.

The designers of this whole thing were very clever, and foresighted, with much of what we have now being pretty solid and running for a couple decades now.

I don't think I'm going to set up my own email server but it is fun having a better idea of how these things work.

Dale

PS, hello to you down in much-warmer Orlando.  I have a friend from here who retired down to a part of Orlando (I've never been to his place) somewhere near the airport. 
He, as an old western Wisconsin transplant, keeps sending me notes on how sunny and warm and fun to walk without a jacket on.  I keep telling him we have excellent weather reporting with numerous services and CWOP and he doesn't need to rub salt in the wound.

On the other hand when your days are sweltering and heavy with humidity I tell him of high 60s with fluffy white clouds and gentle breezes!  I guess it works both ways.
Thanks again.
ECWx.info
&
ECWx.info/t/index.php

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #14 on: January 25, 2021, 05:08:28 PM »
To illustrate what galfert so eloquently explains...

My last name is Coombs. Back in the mid 90's when the Internet first became popular I tried to register the Domain "Coombs" but a business had already registered that name. So I registered "garycoombs.com" and I've owned it ever since. I used it on my own home server for my email and web page 25 years ago. I then used it with several different hosting companies and finally ended up with GoDaddy 20 years ago with whom I've continued to pay my registration every year and where I've maintained my own personal web site for all these years.

My email address and my wife's email address are all "name@garycoombs.com" since I own the domain name. GoDaddy maintains the email server but I own the domain name and I control my email addresses, adding and deleting them whenever I want (I can have up to 500 with my account).

« Last Edit: January 25, 2021, 05:11:13 PM by TraderGary »
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #15 on: January 25, 2021, 05:19:28 PM »
galfert,

I seem to remember that somewhere you explained how you set up your webserver on your Raspberry Pi.
Am I remembering correctly and if so can you point me there?
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline galfert

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 6822
Re: Raspberry Pi 4B as Web Server
« Reply #16 on: January 25, 2021, 05:51:31 PM »
No, sorry, it wasn't me whom posted about how to set up a webserver on a Raspberry Pi.

I can point you in the direction of the names of some web servers you could run on a Raspberry Pi though. The two most popular choices I believe are Apache and Nginx, but there are many more choices like Lighttpd and others. They each have an angle.

Apache is the most prevalent
Nginx is the best performer in terms of capacity
Lightthpd is the most lightweight
« Last Edit: January 25, 2021, 05:54:35 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 #17 on: January 25, 2021, 06:18:07 PM »
Thanks, George.
The server I'm on with GoDaddy is Apache.
If that will actually run on my Raspberry Pi (amazing!) then that's what I'll use.
What do you use on your Raspberry Pi?
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline Bushman

  • Forecaster
  • *****
  • Posts: 7552
    • Eagle Bay Weather
Re: Raspberry Pi 4B as Web Server
« Reply #18 on: January 25, 2021, 07:33:18 PM »
Apache is part of the LAMP stack guide I posted above.  Easy to do.
Need low cost IP monitoring?  http://wirelesstag.net/wta.aspx?link=NisJxz6FhUa4V67/cwCRWA or PM me for 50% off Wirelesstags!!

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #19 on: January 25, 2021, 07:49:25 PM »
Thanks Bushman!
I'm doing a thorough readthrough before I manage to screw it up!   :???:
« Last Edit: January 25, 2021, 08:40:25 PM by TraderGary »
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #20 on: January 25, 2021, 08:49:43 PM »
From my reading and looking at user pages I think I might like setting up WeeWX to work with the Apache web server.
WeeWX is written entirely in Python. I have some familiarity with Python.
I'm thinking that this should make for straight-forward site maintenance.

Any thoughts or advice?
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: 1120
  • FN25ie61jw
    • MorewoodW34
Re: Raspberry Pi 4B as Web Server
« Reply #21 on: January 25, 2021, 09:06:07 PM »
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.

Offline galfert

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 6822
Re: Raspberry Pi 4B as Web Server
« Reply #22 on: January 25, 2021, 09:37:13 PM »
Thanks, George.
The server I'm on with GoDaddy is Apache.
If that will actually run on my Raspberry Pi (amazing!) then that's what I'll use.
What do you use on your Raspberry Pi?

I don't have a personal website. I do enough work website stuff that I haven't wanted to also do a personal one. Maybe some day.
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 #23 on: January 25, 2021, 09:48:45 PM »
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 ?
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy

Offline TraderGary

  • Stock Market Wizard
  • Forecaster
  • *****
  • Posts: 516
  • Amateur Radio W9VJ
Re: Raspberry Pi 4B as Web Server
« Reply #24 on: January 25, 2021, 10:54:52 PM »
galfert,

If I registered my new weather station domain name with GoDaddy, how do I use that domain name on my Apache Web Server on my RPi?
Davis Vantage Pro2 Plus 6163 (Wireless) | Davis WeatherLink Live 6100 | Meteobridge Pro
WeatherLink | WundergroundCWOPAWEKASWindy