Just trying to put something on my raspberry pi and checking load
21:49:23 up 49 days, 20:21, 5 users, load average: 0.96, 1.22, 1.07
Edited: 2013/05/13 Assumption of Debian Operating System
I realized that wordpress takes 7~9 seconds to load on raspberry pi 256Mb after testing various of ways to speed it up. Unfortunately without running caching service such as varnish or APC there's no shortcut to reducing the load time. Hence someone recommended a light weight blogging system known as serendipity. Dispite the funny backend interface. It's is without a doubt, blazing fast and support mobile client with a cute template installed. It's a big daunting for beginners but is fairly simple and straight forwarded to setup and operate.Assuming you have installed mysql server and know the basic about LNMP.
Before starting with the goodies, layout the basic user & group permission.
adduser -g nginxgroup -d /dev/null -s /dev/null nginx
wget -c http://nginx.org/download/nginx-1.4.1.tar.gz *from the official nginx, need to get exact latest version.
tar -zxvf nginx[tab].tar.gz *The tab should auto complete the naming of the version
We're compiling nginx with everything possible just to be lazy later on in case we needed anything, this does come at a big performance loss but for beginner who cares. I personally like my prefix in /etc/nginx but it's up to you.The sbin-path is important as that's where executable file is located, think of it as Windows(R) .exe file
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin --user=nginx --group=nginxgroup --with-http_ssl_module --with-http_spdy_module --with-rtsig_module --with-select_module --with-poll_module --with-file-aio --with-ipv6 --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-pcre-jit
I've left out --with-mail, --with-mail_ssl_module, --with-google_perftools_module , --with-cpp_test_module , and the rest can be found at ./configure --help
sudo make install *make install doesn't work without being root since you are installing into a restricted area of /usr/sbin.
sudo aptitude install php5-fpm *you could compile php5 but it's a bit time consuming
sudo aptitude install vim *my favorite editor, :set nu and :syntax on is useful within vim settings
sudo vim /etc/php5/fpm/pool.d/www.conf
set line 91 or pm.max_children = 5 and change to 2 since we're on 700Mhz cpu and it's a single core therefore having multiple fork of processing at the same doesn't make any sense.
set line 96 or pm.start_servers = 2 and change to 1
set line 106 or pm.max_spare_servers = 3 and change to 1
set line 117 or ;pm.max_requests = 500 and remove the ; and change 500 to 25
use :wq to complete write and quit vim
sudo service php5-fpm restart
head to http://www.s9y.org/12.html to find the latest version
mkdir /var/www && chown -R www-data:www-data && cd /var/www
wget -c http://prdownloads.sourceforge.net/php-blog/serendipity-1.7.tar.gz?download
tar -C /var/www -zxvf serendipity[tab]
cd serendipity[tab] as needed
Now configure /etc/nginx.conf or sudo vim /etc/nginx/vhost/www.yourdomain.ext.conf
remember to sudo service nginx configtest after making any changes.
sudo service nginx reload as oppose to restart to reduce downtime. We hate downtime right?
For future reading: I suggest reading up http://tengine.taobao.org/ which is based on nginx 1.2.9 but contain my dynamic module making commercial site feasible.
Continue reading "Raspberry Pi Web Server with Serendipity"