Last month, my article my resume as an operating system made a buzz during one week.
Thanks for your interest !
By the way, this buzz has forced me rethink my webserver. My personnal server has enough power (4 cores, 16GB RAM, 2 hard drives RAID 1). The main problem was my internet connection.
Now, my problem is solved thank to CloudFlare.
This article is not my solution, but an idea. Many people uses Raspberry pi as server (webserver, files, media sharing...) but in fact it is not appropriate to.
A pure developer (or geek...) think that a CMS is the evil... In my opinion it is a fantastic tool ! I use Ghost platform (running in a docker container).
Last month, while I was looking to Apache log files I saw many people (or robots ?) testing standard administration URI. The best security is to make a static website while keeping my Ghost platform as a publication tool.
It is very simple, wget utility has a "recursive" option :
wget -r -np https://www.mathieupassenaud.fr
Do not ever ascend to the parent directory when retrieving recursively. This is a useful option, since it guarantees that only the files below a certain hierarchy will be downloaded.
Turn on recursive retrieving. The default maximum depth is 5.
A CRON job do this work for me. Now, my Apache configuration is not a proxypass ; a basic configuration to a static website. This is the best security.
With this affordable computer, you have the choice between 2 storages :
The best storage ever is RAM, my entire website fits in 22M :
[email protected]:~/site$ du --max-depth=1 -h 22M ./www.mathieupassenaud.fr 22M .
A Raspberry PI 2 has 1Gb of RAM. This is enought.
First of all, I disabled everything except a SSH server and nginx.
I pushed my static website to /var/www/html, no special configuration.
I made some performance tests (see bellow), then I created a ram disk (tmpfs, not ramfs) and mounted it on /var/www/html, after that I copied all files.
mount -t tmpfs -o size=100m tmpfs /var/www/htmt
server : Core 2 quad, 16gb RAM, raid disks. Apache 2.4 - gigabyte ethernet
Raspberry pi 2, 900Mghz, 1gb RAM, 16gb sandisk ultra SDhc (30MB/s they say...) - 100Mb/s ethernet
I use Apache Jmeter.
Here are 4 comparaisons :
Indead, static files provides better performance. Easy to understand, however some people said that node is the best implementation ever.... :-)
Stored on SD card
No coment ? hum... note that Ghost is slower than a SD card in a raspberry pi ^^
In fact, there is no software optimisation. It was a pure hardware test.
A Raspberry PI can server as a webserver, for static file directly in ram it is realy powerfull.