Wordpress Server


35 posts   Page 1 of 2   1, 2
by tibmeister » Mon Jul 02, 2012 9:01 pm
Currently I am paying a hosting company to house my Wordpress site, and I am looking at Raspberry Pi to replace that. I have used Linux in the past (Slackware), but I'm hedging a bet that with Apache (or this nginx), MySQL, PHP, and such I could probably get Wrodpress up and running on a Raspberry Pi base install and transfer my site over to this. Probably would get a 32GB SD card for the storage and wrap it all up in a nice breadbox from Radio Shack. Taht would be nice sitting in my home DMZ.
My question is, does anyone have any experience with running Wordpress with Linux, or specifically the distro that comes with Raspbery Pi?
Posts: 3
Joined: Mon Jul 02, 2012 8:58 pm
by Bioshox » Mon Jul 02, 2012 11:01 pm
You'll have no problem getting Wordpress running on your raspberry pi.

Although you do need to remember raspberry pis are not designed to be production web servers. It won't be as fast as your current hosting company nor will it be able to handle heavy traffic loads.

You also need to consider the fact that you may not have a static IP so binding a domain name may be an issue.

Apart from that the distro has nothing to do with Wordpress running, you just need to ensure you have a supported version of Apache or NXINX (I recommend Nginx for the pi) and a version of MySQL running, which are both capable of running on the raspberry pi by a simple apt get.
Owner of: http://www.fusionstrike.com - I make gorgeous Raspberry Pi Tutorials :)
Posts: 100
Joined: Sun May 27, 2012 12:18 pm
Location: Manchester, United Kingdom.
by Un4Seen » Sun Jan 20, 2013 7:56 pm
Hi!

I have noticed that it's been a long time since this thread has received its last reply. Regardless, I'm hoping that somebody has really tried WordPress on the Raspberry Pi and can help me with some info.

I've installed WordPress on the Pi in no time, got it up and running very easily (credits go to the great official WP tutorial for that, which can be found on their site).

Anyway, I'm experiencing extremely long loading times for my WP blog hosted on my RPI. It takes an average 11 seconds to just load the first page. I've tested it with a nice website benchmark (http://www.webpagetest.org). Images seem to load for very long times, but what's bugging me even more is that it takes about 11 seconds until the benchmark receives the very first byte sent back from the Pi (the images load in parallel after that). Indeed, if I try to go to my WP from a browser, it takes 11 seconds until I get anything to load in the browser, just the waiting cursor before that, nothing else. Probably that explains why all other tests also measure 11 seconds for the page to load. I'm wondering what happens on the Pi in those 11 seconds...

I've got nothing special eating the Pi's CPU, it's mostly idle. I have a class 10 (30 MB/s) SD card in it, which is about as much as the USB hub of the Pi can do, so there's no point in adding a faster card and I doubt that's the problem anyway. I have Apache2, Tomcat 7, MySQL 5.x and PHP intalled on the Pi, but they don't really use the CPU. I'm accessing the WP blog through Apache and I'm pretty sure it uses PHP and MySQL as well.

The RPI is behind my home router, but that's probably not the problem either because I can load normal HTML with a few images in only 0.2 seconds from under the very same Apache web server running on the very same Pi.

So what is wrong, I wonder. Has anybody else tried WP on RPI? Any idea how I could debug it and find out what's taking so long for the page to load?

Thanks you in advance for any useful info!
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Lob0426 » Sun Jan 20, 2013 8:25 pm
I have WordPress on my RasPi server. It indeed does take a long time to load pages.

I am gearing up to move my SQL over to a second RasPi to see if that speeds it up some.

This topic has some discussion about speeding up WordPress.
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=29885&p=262017

He pushed it pretty hard. Moving graphics onto the Internet. I prefer to have everything here.

I will post my results after moving SQL.
512MB version 2.0 as WordPress Server
Motorola Lapdock with 512MB
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!
User avatar
Posts: 1903
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
by Un4Seen » Sun Jan 20, 2013 10:04 pm
Thanks! Looking forward to see your results!
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Un4Seen » Mon Jan 21, 2013 1:38 am
I have made substantial progress by starting to use the WP Super Cache plugin. The loading time of my main WP page has been reduced from ~11 seconds to ~2.35 seconds! Amazing, considering that this main page contains a lot of large images hosted on the Pi. Obviously, the first load is slower (still 11 sec), but consequent loads will be much faster.
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by technion » Mon Jan 21, 2013 2:31 am
I've seen a number of seemingly unrelated issues resolved in this way so I'm going to start referring to it..

Have you tried running rpi-update? The new kernel seems to improve USB, and therefore network, quite significantly.

Secondly, particularly when you talk about images - I would try loading varnish. If those images are being read off your SD card, the performance of that will be quite relevant.
Posts: 231
Joined: Sun Dec 02, 2012 9:49 am
by Lob0426 » Mon Jan 21, 2013 6:18 am
I might have to try super cache also. Sounds like it helps.
512MB version 2.0 as WordPress Server
Motorola Lapdock with 512MB
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!
User avatar
Posts: 1903
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
by Un4Seen » Mon Jan 21, 2013 7:53 am
Hi!

I'm running the kernel updates (rpi-update) on a regular basis, so I think I'm up to date with that.
I'll have to check out varnish when I'll have some time (don't know yet what it is), because indeed the page that I'm referring to (which had initial loading time of 11 sec) loads many megabytes of PNG files...
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by titanicsaled » Wed Jan 23, 2013 10:11 am
The biggest limitation of the Pi for wordpress is CPU cycles. Even with just one user loading a page it consumes 100% of the Pi's cycles for a few seconds. I wouldn't even think about using the Pi to replace a production wordpress webserver. You also have to think about the possible downtime as a result of using the Pi. Your router could stop responding, the Pi could stop responding, you could have a powercut, your internet connection could go down. There are ways of tackling all these problems but it requires a lot of effort.
Posts: 15
Joined: Tue Feb 28, 2012 4:24 pm
by Un4Seen » Wed Jan 23, 2013 10:24 am
titanicsaled, what you say is all true, sometimes I need to stop the Pi to make a backup from the SD card, other times I just need to restart it for some reason, my internet connection does go down from time to time. I estimate that on average the downtime of my WordPress site will be around 20 minutes per day. But that's all right, because it's a personal site and it's not a tragedy if it temporarily becomes unavailable. The idea of having my own site hosted on my own server just warms my heart too much to give it up because of small inconveniences :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Un4Seen » Wed Jan 23, 2013 11:39 pm
Should anybody be interested, I have written a series of articles about my experiences with WordPress on the Raspberry Pi. In these articles I write about the theoretical aspects of a Pi-based WordPress sever, but I also offer a step-by-step guide about how to install and optimize WordPress on the Raspberry Pi. And to prove that I'm serious about it, the articles are posted in WordPress, hosted on my Raspberry Pi :)

You may start reading here:
http://iqjar.com/jar/wordpress-on-raspberry-pi/
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by technion » Thu Jan 24, 2013 9:26 am
titanicsaled wrote:The biggest limitation of the Pi for wordpress is CPU cycles. Even with just one user loading a page it consumes 100% of the Pi's cycles for a few seconds. I wouldn't even think about using the Pi to replace a production wordpress webserver. You also have to think about the possible downtime as a result of using the Pi. Your router could stop responding, the Pi could stop responding, you could have a powercut, your internet connection could go down. There are ways of tackling all these problems but it requires a lot of effort.


Just to be fair to the pi - most of these problems aren't the pi's fault.
You could put in a $10K server and still be affected by power, domestic Internet services, cabling issues, and the ever pressing requirement to reboot things to apply updates.

The pi, based on its price, would possibly by the easiest use case for failover hardware, in that you could buy two pies quite resonably.
Posts: 231
Joined: Sun Dec 02, 2012 9:49 am
by Un4Seen » Mon Feb 04, 2013 11:14 pm
Hi there!

Now that my WordPress site is up and running on my Raspberry Pi, I'm starting to have higher aspirations. I wish to get a second Pi and replicate my WordPress site onto it. This way I will be able to guarantee almost 0% downtime for my website, especially if I put the second Pi in a different network, with a different ISP, in a different building. The chances of a power failure or an internet connection breakdown at the same time for both Pis would be close to 0. Also, I wouldn't have to worry about rebooting one Pi because the other one would be running and serving potential site visitors. Finally, the site load would be distributed between the two Raspberry Pi servers, which in theory guarantees twice as good response times. Well, I only have a handful of visitors every day, so load balancing might not be that important for now, but I find it really cool to ensure 100% percent availability this way. It's a great learning experience for me, trying to accomplish this.

The question is how to go about this. There are WordPress plugins for duplicating the whole WP site, but it would have to be done manually. I'd prefer an automatic solution, which synchronizes the two servers on its own. It's not just a question of publishing content to one server and getting the HTML, PHP, image and MySQL database files onto the other computer. Things get more complicated because different users will be served by different servers (because of the load balancing), so different comments might be saved into different databases. The synchronization would have to go both ways. A way to simplify things would be to have only one database and have both servers use it, but I'd prefer to have two, otherwise when the central DB server goes down, the other site will also get crippled.

I'm also still thinking whether to achieve the load balancing through A records associated with the domain or to use nginx for this purpose.

Has anybody tried any of this stuff? Is there a good way to do this with low-resource servers such as the Raspberry Pi?

Thanks!
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by technion » Tue Feb 05, 2013 1:45 am
Replicating site is one thing, but availability in the way you describe is another.

When I type an address into my browser, it's got to go somewhere. Now you could hack up a form of load balancing by giving the same address two DNS records, but my browser will have no knowledge of one being up, one being down.

High availability solutions generally work of processes that will detect when "primary" is down, and have the second take over its IP.
This won't work unless they are sitting next to each other.
Posts: 231
Joined: Sun Dec 02, 2012 9:49 am
by tonyhughes » Tue Feb 05, 2013 2:27 am
You cant just randomly load balance between two Wordpress sites and two database servers, as you need to merge changes back in cleanly.

You also need a robust way of performing the load balancing to start with.

If you have a reliable DSL connection (i.e. less than a handful of PPP disconnects a day is okay), and you have reliable power, then hosting a site on a single Pi at home is perfectly reasonable.

If the site is a commercial site and your income (or others) depend on it, then you need to think about more serious hosting.

http://www.geek101.co.nz is hosted at home on a DSL connection (though not on a Pi).
Baked Linux Mod http://www.geek101.co.nz/bakedlinuxmod

Easy install of Drupal, Wordpress, RazorCMS, Chyrp, Apache, Nginx, Lighttpd, firewall, Webmin, VNC, RDP, FTP servers, mailservers, MySQL, SQLite, Transmission and more...

tall.co.nz/webcam.jpg
User avatar
Posts: 931
Joined: Wed Dec 26, 2012 3:46 am
by Un4Seen » Tue Feb 05, 2013 8:47 am
No, no, no, my site is not commercial and and it's not visited by thousands of people. It's just my "box of knowledge" about some stuff that I want to share with the world. Still, I'd like to ensure that it's up and running all the time, even is usually only 10-20 people check it our every day (for now).
I have a pretty solid DSL connection, but from time to time it goes down for a few minutes (twice a week or so). The power is also quite reliable, we haven't had an outage in years and there's nothing a UPS can't fix for a Pi or two.

Questions:
1. What is "a robust way to perform load balancing"?
2.
Code: Select all
High availability solutions generally work of processes that will detect when "primary" is down, and have the second take over its IP.
This won't work unless they are sitting next to each other.
That's fine, I can have them next to each other. How would you detect that the primary is down and have the second take over its IP?

Thanks,
Andras
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by tonyhughes » Tue Feb 05, 2013 8:52 am
I just don't think enterprise level load balancing is a worthwhile topic here (for me to put effort into). The effort and expertise required is totally disproportionate for hosting a blog on a Pi. There are plenty of sites out there with the information already laid out.

If somebody else wants to jump in and help, thats cool.

If you want to bodge something up thats a different story, but honestly, failover is about 100x easier to setup than load balancing, but you still need a router capable of that (generally a branded consumer/small business DSL/cable modem wont be able to), and even then, you will still only have one of those, and they would have a similar reliability level to the Pi.

Redundant parts of a network/server setup are only helpful for items likely to fail, or where uptime is critical...

Google "load balancing mysql servers" and allow a few hours reading time.
Baked Linux Mod http://www.geek101.co.nz/bakedlinuxmod

Easy install of Drupal, Wordpress, RazorCMS, Chyrp, Apache, Nginx, Lighttpd, firewall, Webmin, VNC, RDP, FTP servers, mailservers, MySQL, SQLite, Transmission and more...

tall.co.nz/webcam.jpg
User avatar
Posts: 931
Joined: Wed Dec 26, 2012 3:46 am
by technion » Tue Feb 05, 2013 9:01 am
Un4Seen wrote:That's fine, I can have them next to each other. How would you detect that the primary is down and have the second take over its IP?

Thanks,
Andras


I found it hard to find a good document on this - because products have been depreciated or had their roles changed several times and most guides are out of date.
This one, whilst written for Linode hosts, seems to cover the tools you will need:
http://library.linode.com/linux-ha/ip-f ... buntu-9.10
Posts: 231
Joined: Sun Dec 02, 2012 9:49 am
by Un4Seen » Tue Feb 05, 2013 9:13 am
Hmm, looks like a good tutorial (I just took a quick look for now). I think the main problem might be that, as it clearly says in the first lines, this solution might not be good enough for sites with dynamic content, such as mine. Probably the biggest challenge is synchronizing the databases, because it's possible that some dynamic content goes into one DB and some other content goes into the other one. As far as I know, MySQL doesn't really support real synchronization, only master-slave replication. Some people have managed to get master-master replication up and running but it looks too complicated...
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by Lob0426 » Wed Feb 06, 2013 9:18 pm
Made a first attemp at moving SQL to a separate RasPi. Messed something up. Had to reload from backup. I will give it another try.

Tried WP Super cache. Worked fine for the opening page, but lost all the other pages. It stated an error about time stamps for the pages. All of the pages were copied into this install of Wordpress so they have the same time stamp. Looking for a solution.

Bought a killawatt meter the other day. My server, a modified 256MB ver1.0 with a hardwired 4 port hub that is back-powering, is at 5watts. A 512MB RasPi with an Adafruit PSU was at 4watts.

Image
512MB version 2.0 as WordPress Server
Motorola Lapdock with 512MB
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!
User avatar
Posts: 1903
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
by Wasp_Box » Fri Feb 08, 2013 6:16 pm
Andras,

I like your blog. Very informative. I'm amazed at how fast it is as well (assuming it really is running on your Pi). Another project to have a go at!

Regards

WB
Posts: 19
Joined: Fri Nov 16, 2012 11:20 am
Location: UK
by Un4Seen » Fri Feb 08, 2013 9:52 pm
Wow, thank you! You're the first person who's given me any kind of feedback :) It's a new thing, it's... sharing my knowledge and my projects with the world so hopefully others can learn from it :)

It is indeed running on my Pi. Future plans include:
1. Running it on a dedicated Pi, so that I can use the current one for hardware projects without messing with the site's performance, or
2. Running it on two Pis, using some kind of replication technique. I'm stuck for the moment because I don't know how to achieve real-time DB replication with MySQL (it's not something really supported).
3. Moving the Pi (or Pis) that host the website from the wall plug onto a 12V battery powered by solar panels. This will take time because I don't have the necessary equipment yet, but it'definitely is in the long term plan :)
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
by tonyhughes » Fri Feb 08, 2013 11:25 pm
Un4Seen wrote:Wow, thank you! You're the first person who's given me any kind of feedback :) It's a new thing, it's... sharing my knowledge and my projects with the world so hopefully others can learn from it :)

It is indeed running on my Pi. Future plans include:
1. Running it on a dedicated Pi, so that I can use the current one for hardware projects without messing with the site's performance, or
2. Running it on two Pis, using some kind of replication technique. I'm stuck for the moment because I don't know how to achieve real-time DB replication with MySQL (it's not something really supported).
3. Moving the Pi (or Pis) that host the website from the wall plug onto a 12V battery powered by solar panels. This will take time because I don't have the necessary equipment yet, but it'definitely is in the long term plan :)

If you want to improve database performance, you could try SQLite instead of MySQL, or simply running one Pi as a database server, and the other as an HTTP server, but this is probably a bit redundant unless the traffic supports it.

Replication of a MySQL database is not too hard, but straight out replication won't improve performance :)
Baked Linux Mod http://www.geek101.co.nz/bakedlinuxmod

Easy install of Drupal, Wordpress, RazorCMS, Chyrp, Apache, Nginx, Lighttpd, firewall, Webmin, VNC, RDP, FTP servers, mailservers, MySQL, SQLite, Transmission and more...

tall.co.nz/webcam.jpg
User avatar
Posts: 931
Joined: Wed Dec 26, 2012 3:46 am
by Un4Seen » Fri Feb 08, 2013 11:33 pm
No, no, the goal is not to improve performance. Or at least, that's not the main goal. The main goal is to be able to serve the site even if I stop one of the Pis hosting it and to keep the two Pis that serve the site always in sync, so that whichever serves you, you see the same thing.
Andras
http://iqjar.com
User avatar
Posts: 288
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania