Stuff I'm Up To

Technical Ramblings

NGINX, PHP and a Blank Page — September 29, 2016

NGINX, PHP and a Blank Page

Got Nginx installed, got PHP installed. All ready to go, but all you get from your test PHP page is… nothing.

Catches me out regularly. The php5-fpm daemon runs as the user “www-data”, but the Nginx daemon runs as “nginx”. So Nginx has no permission to the /var/run/php5-fpm.sock file because it’s owned by “www-data”.

Continue reading

Nginx 1.10 and PHP7.0-fpm — September 23, 2016

Nginx 1.10 and PHP7.0-fpm

Keen to press on a try new suff I figured that seeing as I’d now tried Nginx 1.10 that I’d put that together with PHP 7.0.

I started of by thinking I’d remove nginx 1.6 from my workstation, clean the config out and install the latest from the nginx repository. It was all going so well until:

Unpacking nginx (1.10.1-1~jessie) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.10.1-1~jessie_amd64.deb (--unpack):
 trying to overwrite '/usr/share/nginx/html/index.html', which is also in package nginx-common 1.6.2-5+deb8u2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Continue reading

ownCloud — September 20, 2016


We needed a semi-secure method of transferring files between staff and 3rd parties. To handle those frequent times when someone tries to attach a 150MB file onto an email. OwnCloud to the rescue.

It’s come a long way since I first used it. Now it has all kinds of plugins and features. What’s good about it is there are clients for pretty much all platforms – many free. Failing that good old HTML will do.

Continue reading

NGINX and php5-fpm —

NGINX and php5-fpm

This new version of NGINX is tending to be a bit of a pain in terms of installation. Gone are the sites-available and sites-enabled folders and it does a couple of things during installation that really grips my goat.

Getting php5-fpm working with it needs some manipulation of the config. The site configs are now located under /etc/nginx/conf.d/ and they now have a .conf extension. The default being default.conf.

By default this config sticks the ‘root’ directive under the location /. Which when it comes to running php5-fpm and using fastcgi parameters causes a headache. It’s a simple fix, but put simply the previous use of $document_root will not work because the directive needs to be within the server context NOT location.

Continue reading

NGINX and Laravel —

NGINX and Laravel

NGINX needs a little special setup to handle Laravel as Laravel only really serves one page. All others are served through index.php as a route.

index index.php;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying index.php.
    try_files $uri $uri/ /index.php$query_string;

They key parts here are serve index.php as the index page and then using try files when it can’t find $uri serve up index.php and pass the $query_string as the parameters.

Continue reading



Absolutely my favourite web server. Small footprint and very fast to get running.

First add the repositories to your Debian sources by creating the file /etc/apt/sources.list.d/nginx.list

deb jessie nginx
deb-src jessie nginx

Change the release name as necessary.

Then find the ID of the key the repo is signed with so you can add it to the apt key store.

$ sudo apt-get update

You should see you get a GPG error with the ID of the key you need. Copy this and paste it into the next command to download and install it:

$ sudo apt-key adv --keyserver --recv-keys [KEYID]

Job done now just apt update and install.