Skip to main content

Posts

Showing posts with the label open source

Fixing broken thumbnails in Drupal

If your autoscaled images are not loading on Drupal then here are some steps to take to troubleshoot the problem. Firstly, if you have logging enabled then visit http://yoursite.com/admin/reports/dblog to see a list of the events. If you see events with the message "Unable to generate the derived image located at...." then check the permissions on your files directory.  This is usually /sites/default/files. Then check that the GD library is installed for PHP.  On Ubuntu you can install it with apt-get install php5-gd If you don't see any events then try opening the image url in a new tab on your browser to confirm that your web server is properly rewriting the request to index.php instead of trying to serve a file out of the directory. On Nginx you should consider using location blocks like this: # These next locations help with thumbnails - https://www.drupal.org/node/2374961 location @rewrite { rewrite ^/(.*)$ /index.php?q=$1 last; } ...

Setting up Nginx as a reverse proxy for Apache with SSL termination

Reverse Proxy diagram from Wiki Commons We're currently hosting client sites on a Rackspace server and using their Load Balancer feature as a way to terminate SSL and not have to have multisite certificates. We only attach one node to the Load Balancer so we're paying for more than we're using.  My proof of concept is to use Nginx to terminate SSL certificates and proxy to the Apache server.  This will save us £ 225 per load balancer, and since we're using ten of them that's quite a significant saving. My first step was to spin up a free tier EC2 instance running Ubuntu 14.04 LTS.  I guess you can replace this with your favourite cloud or on-the-metal server. Then I installed my packages. These are the ones I remember so YMMV. sudo apt-get install nginx apache2 fail2ban php5-fpm mcrypt php5-mcrypt openssl php5-cli php5 libapache2-mod-php My network diagram is slightly different from the picture for this post in that the web server is hosted on the ...

Caching Laravel with Varnish

PHP Framework popularity as at 2013 - Sitepoint After having a very good experience with using Varnish to cache a Wordpress site we decided to look at caching Laravel. Laravel always generates cookies regardless of whether a person is logged in or not.  This interferes with Varnish which by default will pass all requests with a cookie to the backend and skip the cache. In our particular case our site supported the ability for users to login and would then present them with custom content.  This means that cookies are not restricted to a particular path so we can't discard cookies based on the request as we did for Wordpress when discarding everything except /wp-admin/* requests. My solution was to use a package called session-monster ( Packagist  ) which sets a response header if the data in the Laravel session can be ignored.  Varnish can detect this header and prevent the cookie from being set since we don't really need it.  This together with t...

Wordpress on Hiphop / Nginx / Varnish

I recently was asked to investigate speeding up one of the Wordpress sites of a fairly large government organization in Britain.  A large part of my investigation focused on the server stack because I felt that we could get more out of the hardware that was provisioned for us. I decided to set up a stack on my development machine to see how it would work and if it was feasible.  I settled on nginX with hiphop and a Varnish frontend cache.  I realize that nginX would be just fine as the cache and server but in this particular case it would not be possible to replace Apache with nginx on the live server.  I also wanted to experiment with ESI and it looked better documented in Varnish than nginx. Installing HHVM is very easy: wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | apt-key add - echo deb http://dl.hhvm.com/ubuntu saucy main | tee /etc/apt/sources.list.d/hhvm.list apt-get update apt-get install hhvm Installing nginx is also very easy:...

Fixing the "smsbox_list empty" error in Kannel

I got this error even though I had an smsbox defined.  Unfortunately I had forgotten to create the smsbox-route group, so this is a very quick fix: #--------------------------------------------- ## SMS ROUTING ##--------------------------------------------- group = smsbox-route smsbox-id = mainbox smsc-id = ztemodem-smsc-group sim-buffering = false ... continues ... Just make sure the id's matchup, so my smsbox group begins with this: #--------------------------------------------- ## SMS BOX ##--------------------------------------------- group = smsbox smsbox-id = mainbox ... continues ... And my SMSC looks like this: #--------------------------------------------- ## GSM MODEM SMSC ##--------------------------------------------- group = smsc smsc-id = ztemodem-smsc-group ... continues ... This successfully cleared the "smsbox_list empty" error and allowed messages to be delivered properly. Kannel had until then been able to send messages and receive delivery...

Setting up a Kannel SMS centre on a Raspberry Pi with a K3565-Z modem

Our office (who wants me to mention how awesome they are) had a need for a means to send/receive automated sms messages relating to online banking. We decided to give a Raspberry Pi the job and so I have had the fun of setting it all up. First off I installed Rasbian (  http://www.raspbian.org/  ) which is a Debian fork and is sufficiently easy to do following the guide on eLinux ( here  ) which is linked to from the Raspberry Pi project website downloads page. Next came a standard LAMP stack install.  I needed to have a web-server running because we will be running a management package on the box to track messages etc. Next came Kannel.  I used the default package available from the Rasbian repositories so there was no need for fiddling. My kannel.conf file was the next hurdle.  For the most part this is pretty easy to set up from the examples given on Kannel's site and elsewhere on the web.  I want to just mention the modem part, which was pe...

CakePHP : Adding a file upload and adding a select list of URLs for users in a CMS

CakePHP automagically generates textboxes for users, but it's usually a project requirement that these boxes are "user friendly". Adding CK editor to CakePHP is easy, but lets go a few steps further and give it the ability to allow users to upload images directly into their content and to select a list of pages when creating a link. This article is based heavily on two articles ( Adding file upload in CK editor and Adding a ‘Link to local page from site’ field ) which I have simply modified to be CakePHP specific. So all credits to Ben Roberts and Zac. Step 1 - Adding CK editor to CakePHP with the FileManager plugin 1) Download CK editor from the official site and unzip it into your /app/webroot/js directory. To make things easy I put it in /app/webroot/ckeditor directory. 2) Download FCK editor from the same site.  It was at the bottom of the CK downloads page (because it is deprecated).  Unzip it to a temporary directory and copy the filemanager directory (fcke...

Kannel Configuration

It took a whole day in front of an ssh screen onto my server to get Kannel up and running, but I finally managed to get a box ready to be tested. A very useful resource is the SMSC emulator from Selenium Software . They're kind enough to give it away, and it is definitely the pick of the litter compared to the other free options. I needed this because for some reason Kannel wasn't liking the fake SMSC setting. I had noticed that the binary file they refer to in their documentation was missing from my install (a Debian apt-get install kannel default). So I thought I would rather emulate an SMSC than fiddle with trying to get the fake one running. I had a few errors that were baffling due to the lack of thorough documentation, but the users@kannel.org list (subscription needed to send to it) was awesomely helpful. Within an hour of posting my config files and outlining what I had tried I had a solution thanks to a tip from them. The mailing list is searchable so it can take...

Installing PHPmyadmin on Kubuntu 9.10

I've now nearly fully given up on suckling from the breast of Microsoft. My little Linux laptop is now a fully functioning development box. I must say that so far I have had no separation anxiety as a result of leaving behind the sweaty manboobs of Microsoft and moving on to a more solid diet. Anyway installing PHPmyadmin is a cinch. I used Kpackagemanager (the Ubuntu version is Synaptic) to get the package. In retrospect I prefer the Debian apt-get approach of the command line but I like the GUI for its ability to search through all packages to discover cool new toys. The only trick to installing PHPmyadmin is that you need to reconfigure it once it is up. Jump to a Konsole and run the command: sudo dpkg-reconfigure -plow phpmyadmin This will give you the configuration options that the GUI installer does not. Specifically it sets up the config files so that Apache knows to alias the /phpmyadmin directory to the proper /etc/phpmyadmin. If for some reason (as was the...

Asterisk Open Source g.729 driver

Asterisk is an Open Source "all in one" telephony system. It's really hard to configure, but that's a story for another day. Asterisk and g.729 Asterisk supports the g.729 codec to compress audio. Digium, the guys who support Asterisk development, have a commercial offering on their site . There however is an open source g.729 codec implementation for Asterisk developed available ( click here, for some reason Blogger is hiding my link ). Installation questions are answered in the discussion on the Google group ( here ), but the installation is actually very simple. All you need to do is wget the appropriate file to your /usr/lib/asterisk/modules directory and then mv it to codec_g729.so (or codec_g723.so as may be). It should take you only a few minutes to work out which file version to download. Other Asterisk resource links I found these links to be invaluable in sorting out my installation: Click on this link if you are getting a Non existent user in As...

Zabbix open source monitoring

ZABBIX (visit http://www.zabbix.com ) is an open source distributed monitoring solution for enterprise level applications. It is capable of providing detailed networking information as well as polling servers to establish their health. ZABBIX was created by Alexei Vladishev, and currently is actively developed and supported by ZABBIX SIA. It is possible to configure ZABBIX to email alerts to the administrator for just about any event. This means that even if you have several servers to watch you will be able to react quickly to any arising problem. ZABBIX code is released under the GPL2 license ( General Public License 2 ). It is free to use and requires no licensing fees. The ZABBIX company offers both free and commercial support options. My company currently has 8 production servers, three of which host mission critical applications and databases. It is possible for one of our operations staff to remotely login to each machine, check the status of the applications, do a trace on...