8

Recently read this article: http://www.makeuseof.com/tag/host-website-raspberry-pi/ where the possibility of hosting a website on a Pi is discussed. But I'm not sure if it's capable of hosting what I want exactly. I have a website I'm in the process of making and I've been thinking I'd rather host the site myself than pay for someone else to host it for me. It's a basic website just to display contact info and my recent projects (text and pictures). Here's an example of the end goal: http://brianmaierjr.com/.

Would it be possible to host something like this on a Pi? What are some constraints I should keep in mind when looking for a computer to host this site?

EDIT: Just for some more information, I doubt there'll be any more than 100 concurrent sessions at a time and I don't think security or traffic is too much of an issue really. Just a small thing to show employers.

EDIT2: For clarification I've done a lot more research into this and I'm almost for sure heading towards the direction of Node.JS. My background is in .NET development and just earlier this month I've taken a break from c# and moved into JS. Thanks so much for the help by the way guys. Really appreciate all the anecdotes and objective info as well!

3
  • YES, you can host a website on the Pi3 and you will surprised for his capability. for more information, please read this from raspberry: raspberrypi.org/documentation/remote-access/web-server/…
    – reicros
    Commented Dec 20, 2016 at 20:34
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Ghanima
    Commented Dec 27, 2016 at 21:38
  • Hi mate. So how did you end up going with this? :D I just got some upvote today and noticed you never selected any answer. Please help the community conversion rate on answers and select your preferred one. Hope it all worked out well!
    – Piotr Kula
    Commented May 9, 2018 at 13:44

7 Answers 7

4

100 concurrent sessions is actually quite a lot: considering a typical employer will spend about 5-10 minutes browsing your site, you'll have to advertise your site to thousands of employers each day to get that much traffic.

Realistically, a Raspberry Pi is sufficient for such a site. It will be noticeably slower than a similar site on a commercial hosting (not because of the Raspberry, rather because your site won't get backed by a CDN), so your clients will have to wait for an extra couple of seconds before pages start to load. But it will be usable.

Roughly speaking, you should expect up to 100MB of RAM to be consumed by the system and another 100 by the web server. The rest will essentially be shared between disk cache and server-side scripts.

2
  • How slow are we talking here to load between pages? And what exactly causes this slowness if not the PI? Is it more dependant on my internet connection support the server? Or the Pi's hardware?
    – J.Doe
    Commented Dec 21, 2016 at 17:49
  • 1
    @J.Doe When someone loads Youtube, they will get data directly from their provider's cache, or at least from a proximity server in their country. When the same person loads your site hosted on a Pi, the data will need to make an actual roundtrip around the globe between the user, your Pi and the DNS server you're using to get your Pi a domain name. Unless you pay a premium, all these connections will be slow. Could easily be a couple of seconds of delay. Commented Mar 31, 2020 at 7:16
4

Sure you can! It all depends on how you configure the Pi. I can see ye'old good LAMP answers already creeping up... I would strongly suggest to stay away from Apache traditional full PHP (CPU & RAM HOGGERS)

This is a fact: Instead for your front end you should must use nginx instead. It was designed for embedded devices and runs extremely well on the Pi, especially the 3.

The back end is all up to you but In My Honest Opinion

  • Python is Pi's programming language. If you know Python then use it. Plus there allot of frameworks in Python for creating websites easily.
  • I would suggest Node.JS since it is extremely lightweight but you need to learn it. Node.JS was built to handle a ton of connections easily.
  • My self on the other hand being a .NET G33K - I host .NET MVC websites because I can build and deploy them rapidly on my dev machine. Hosted behind nginx they run just f***king great (I cant even believe how great they run it blows my mind) and as of 2018 Dotnet Core 2.1+ can build native libraries that do not need any extra SDK's installed on many Linux distros, including Raspbian.

In terms of SQL storage... You can do MySQL if you feel like you need a fully featured SQL database engine but you can get away with SQLlite really easily now a days too.

7
  • Assuming the OP(or anyone else interested in the question) is a not a javascript/.net/flavor of the day developer (he/she has not indicated AFAICT), it would be helpful to recommend some prebuilt packages and/or tutorials that would help evaluate. Commented Dec 20, 2016 at 22:08
  • It is unclear what flavour of programming the OP wants. To list all packages of everything I mentioned will take up 2000+ pages... yea. Not a very concise answer. I gave other options that are not LAMP and a path for the OP to explore. Python, Visual Studio and Node.JS all have their own repositories, with their own package managers and a crap ton of tutorials on line...
    – Piotr Kula
    Commented Dec 20, 2016 at 22:25
  • +1 For the vast majority of things done on the RPi, SQLite is plenty. I'm not actually sure why anyone uses MySQL.
    – Jacobm001
    Commented Dec 21, 2016 at 17:24
  • 1
    I must admit though, the idea of node.js being extremely lightweight kind of made me laugh. I mean, it's a decent language, sure, but I couldn't call it extremely lightweight by any means.
    – Jacobm001
    Commented Dec 21, 2016 at 17:24
  • @ppumkin Woops should have specified my programming bring up was actually with c#, JS and .NET applications. So this recommendation of Node.JS is REALLY attractive to me. Didn't know this was possible but now I really want to try this. Know any good tutorials or guide for building a website using Node?
    – J.Doe
    Commented Dec 21, 2016 at 17:52
3

Yes, you can definitely do that. Raspberry Pi 3 is surprisingly capable. I recently put up a self-hosted website on a Raspberry Pi 3 running Nginx, PHP5 and MariaDB with HTTPS and WordPress. Security is the major issues, within a few days up, I've seen many hackers trying to break-in to the server. I documented my complete approach on my website https://www.e-tinkers.com (which is hosted on Raspberry Pi). If you don't have sufficient bandwidth to handle the traffic, you could also consider Raspberry Pi colocation (just google for Raspberry Pi colo).

1
  • 1
    It has been more than 4 years the RPI server is still working perfectly. Since then I have added SSL, upgraded PHP, added a hard disk, added a git server(written in Go) to host my private repo, and added a python Gunicorn server for a few web services that I developed. All running on a RPI 3.
    – hcheung
    Commented Jul 30, 2020 at 6:32
2

I hosted my personal blog in a Raspberry Pi. you can see the stats of this litte computer in this page

https://www.flopy.es/monitor/status.html

In the same raspberry I have my blog, my webpage (more serious), a mail server and a personal cloud made with Nextcloud.

1

Have you tried a solution similar to this?

Try running this in the terminal:

For the official tutorial from remote3.it see the bottom of this post!

Check the OS Version

First, you will need to determine which version of the OS is installed on your Pi. Run:

cat /etc/os-release

You should see this line:

VERSION="8 (jessie)"

This shows you are using raspberry pi Jessie! Or stretch will work also!
If you are using the Wheezy version of Raspbian, or to support other ARM boards using Debian (such as BeagleBone Black and Wandboard), please follow the installation directions here.

Install the weavedconnectd package

First, get the latest repositories:

sudo apt-get update

Next, download the remot3.it weavedconnectd package:

sudo apt-get install weavedconnectd

Run weavedinstaller to configure remot3.it service attachments

Next, run

sudo weavedinstaller

You should then see a list of options, press 2, then press enter Then follow the on-screen instructions to enter your e-mail. Remote3.it will send you an e-mail with a verification code that you must enter by selecting 3 from this menu. After that, your account is active and you can add devices and services. In this case, website!

Now that you have created an account, select option 1, then log in. Note that the password is not displayed as you type. Next, as there are no services yet installed, you will be asked to enter the Device Name. Valid characters include numbers, letters, space, underscore, and dash. After you have entered your name, Press 1 to attach remot3.it to one of your services. Select the type of service you are connecting to, in this case a web server so press 2 then hit enter! You will then be asked if the default port 80 is the port to use press y, if you aren't on port 80 then put n, and then the correct port! You can repeat this with as many ports as needed! Select a name for the service, for example Pi-Web After you enter the name, a few more seconds passes while it is registered to your account. Next, you will be returned to the Installed remot3.it Services menu. Now your attachment to the web service is shown. Press 4 to exit or register a new service or port with the corresponding Keys! Navigate to https://remote3.it and sign in! You will see your devices there and can go to the link provided in your remote3.it account to access server! This link changes regularly! You don't need to port forward your router though!

Remote3.it Official Tutorial Here

0

Disclaimer ... This answer is probably bit tangential to your question, focusing on how to host; as I feel it would be of some help to evaluate. If you feel otherwise, let me know I will remove it.

There is a full tutorial right here on the raspberry pi web site that goes through the motions of setting up the hardware and the required software to self host a wordpress installation on the PI and make it accessible to clients within the local network.

With a bit more configuration (port forwarding, packet filtering etc) on the router facing the internet the same should be accessible from outside the network. This bit would be specific to how your network is connected to the internet.

Briefly this would be one of the many ways to go about doing that

The magic word of the day is LAMP

L-inux - one of the recommended distros is Raspbian which is Debian adapted to work with the ARM processor powering the PI. you can get it from here

A-pache - one of the venerable web servers out there

Install using sudo apt-get install apache2 -y

There are a number of tweaks possible to control the memory usage as detailed here

If you intend to use the PI as headless (no display), you can use raspi-config to tweak the memory allocated to the GPU to the minimal allowed (16 MB i think) freeing up more RAM to the applications

M-ySQL - one of the most popular database backends

Seems to require apache to be restarted sudo service apache2 restart

Install using sudo apt-get install mysql-server php5-mysql -y

P-hp - not my personal favorite language

Install using sudo apt-get install php5 libapache2-mod-php5 -y

Download Wordpress from http://wordpress.org/latest.tar.gz and follow the instructions in the tutorial to move it into the right folder for apache to find it. With that you can start focussing on content creation.

HTH

1
  • 1
    For small web server on an embedded system with limited resources, i.e. slower clock with less than 256 MB RAM, etc., I would prefer to use a combination of Linux, PHP, SQL-Lite, and NGinx (LIPSLiNG).
    – user91822
    Commented Dec 21, 2018 at 13:10
-1

You can easily host a website on raspberry Pi. It is fun and learning experience. I've recently hosted a blog on raspberry pi. It is load balanced on a cluster of 3 Rpi. If you are keen have a look - https://www.techpint.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.