Agreed! I did this myself and using my own hardware is definitely less expensive than big cloud.
Rather than use AWS or Azure for hosting my stuff, I've gone Raspberry Pi. At first it was an experiment. Today, it's no longer an experiment. I have a cluster of Pis using Debian and consumer grade switches. It has over a 99.9% uptime and is very fast because I write my own server code that does not have have the bullshit overhead of commercial applications. I chose to use Apache2 as the web server and Dot Net core in self hosted mode. I use Apache2 as a reverse proxy. It just fucking works! No problems, it's fast and reliable. I can singlehandedly deal with over 39 websites. No issue what so ever.
I use letsencrypt for the certificates. It's fucking awesome!
My biggest problem is Apache2 seems to run one of my server's CPU to 100% once in a while. I deal with this by restarting Apache2 every day at midnight. That seems to do the trick. I've also got a cron job running that checks to see if my servers are up and texts me in the event a site goes down.
The best part is my Raspberry PIs use only 3 watts. Yes, you read that right. Only 3 fucking watts. Each SBC runs about 6 websites. I probably could do more, but decided 6 sites was enough. I actually do have one cloud server because a customer specifically wanted it, and I use a VM. It only costs me $5/month. It uses a Debian image and I manage it just like all my Pis.
Don't let anyone tell you that you can't run your own servers at home, you most certainly can, and it's cheap!
I printed out a 3D SBC rack that keeps all my PIs tidy.
Have you considered trying out NGINX or HAProxy as an alt to apache? They may not have the issue you are running into with apache and are both just as easy to maintain.
Yea, I considered NGINX. But Apache is simple enough to use and I understand it. But maybe I'll setup one SBC on NGINX, why not?
Thanks!
Good Luck. I like nginx for a lot of things and there are tools to make it stupid easy to use as a reverse proxy so if it fixes the issue you are running into maybe it is worth it. Otherwise, why fix what is not broken.
Monit might help you with that 100% CPU use problem. You can have it mail you at soon as it happens. You can also tell it to restart Apache when the CPU use gets above a certain threshold.
Thanks!
Apache going to 100%? That's really odd, I've never seen that across the dozen I've maintained over the years. Is there something trying to hit the site hard like one of the many site checkers that run out there, or are you maybe trying to pull a lot of data across a USB connection? There's also that stupid psuedo-swap process that the Pi uses (maybe gone now, don't know) that would tie a core or two up, maybe you're running out of memory and it's trying swap but can't?
I have had it happen in some cases.. Though, I am talking about a crazy mount of connections and nginx would probably not have those issues. I can't give more details because of reasons.
The Apache server that has the 100% CPU problem isn't on any of my PIs but on the Debian VM I rent from Lineode. I suspect the configuration may be too limited in memory. I don't really care because even when it runs at 100% CPU, the site still seem responsive enough. My cron job seems to take care of that problem though.
Yes, could definitely be memory related…or their VM are just poorly optimized and leaky.