Web photo gallery application on your server – Piwigo tutorial

http://upload.wikimedia.org/wikipedia/fr/0/07/Piwigo_logo.pngIf you are looking for making a fancy yet simple Web photo gallery to display your weddings pictures, share your last trip photos with your family or as a demo of your work, a comparison of photo galleries to be installed on a server to published your albums can be actually found on Wikipedia.

My favorite one is Piwigo, it’s an open source (Under GPL licence) photo software for the web, written in PHP and requiring MySQL.

The community and project are very active and several plugins are available to make the full experience even better.

To give you an idea you can browse their demo.


Let’s see how to install it on a working server with PHP and MySQL installed. (If not done yet, you can refer to my previous guide on how to install a LAMP server)


To separate your web gallery, you should create a dedicated folder. In root user (su), type:

mkdir /var/www/mygallery

and then download the latest netinstall apps:

cd /var/www/mygallery
wget http://piwigo.org/download/dlcounter.php?code=netinstall -O piwigo-netinstall.php

Now you need to change the owner of this folder to ensure apache user has write access and provide sufficient privileges. In root, type:

chown -R www-data:www-data /var/www/mygallery
chmod -R 775 /var/www/mygallery

And then simply go to http://yourIP/mygallery/piwigo-netinstall.php
to continue the installation. You will need a MySQL database to proceed the installation. If you don’t have one, I suggest you to use PHPMyAdmin to do so and follow the example of configuration for a database.

Virtualhost configuration

If like me, you prefer to have a sub-domain (Or a different domain name than your principle one) pointing directly to your Piwigo instance, you will need to create a dedicated Virtualhost file.

The fastest way might be to reuse some of your existing Vhost file by duplicating it and modifying accordingly to your needs.

Or you can reuse mine and adapt it.

In root, type:

nano /etc/apache2/sites-enabled/piwigo

and here is how mine looks like:

<pre class="lang:default decode:true"><VirtualHost *:80>
        ServerAdmin mymail@mydomain.tld
        ServerName mysub.domain@domain.tld

        DocumentRoot /var/www/mygallery
        <Directory />
                Options FollowSymLinks
                AllowOverride None

        <Directory /var/www/mygallery>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all

Once modified, save it (CTRL+X, then Yes) and reload your apache configuration:

/etc/init.d/apache2 reload

(In root)

You should now have a working web gallery with its own subdomain.

If you use another web photo gallery, which one are you using and why?


Loves to discover web-based apps to install on his own server@home and write articles about it


Add a comment