-
Notifications
You must be signed in to change notification settings - Fork 38
Installing the IIPImage binaries
The following instructions detail how to install and configure the IIPImage server binary as an fcgi module with either nginx or the popular Apache webserver under Mac OS X 10.9. Even if you are not using OS X, included below are useful default configurations for getting IIPImage up and running with nginx.
This guide assumes you have the Homebrew package manager installed.
-
Install nginx and fcgi using your package manager.
$ brew install nginx fcgi -
We will now download the IIPImage JPEG2000 binaries appropriate for our operating system and move
iipsrv.fcgiinto an easily accessible location.First download and unzip
iipsrv-0.9.9-j2k-OSX.zipfrom https://code.google.com/p/oldmapsonline/downloads/list. Thencdto where you unzipped the images:$ cd ~/Downloads/iipsrv-0.9.9-j2k-OSX $ mkdir -p /usr/local/share/iipimage $ cp iipsrv.fcgi /usr/local/share/iipimage/ -
Make a file called
iipserver.confin thesites-availabledirectory within your nginx configuration directory. The default nginx configuration directory when installed with Homebrew is/usr/local/etc/nginx.$ cd /usr/local/etc/nginx $ mkdir -p sites-available $ touch sites-available/iipserver.confUse your favorite text editor to insert the following into
iipserver.conf:upstream iip { server unix:/tmp/iipserver.sock fail_timeout=0; } server { listen 8001; server_name localhost; root /usr/local/var/www; location /fcgi-bin/iipserver.fcgi { fastcgi_pass iip; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param QUERY_STRING $query_string; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; add_header 'Access-Control-Allow-Origin' '*'; } } -
We now must create a symbolic link to our
iipserver.conffrom the sites-enabled directory (using an absolute path for the link target is important!):$ mkdir sites-enabled $ ln -s /usr/local/etc/nginx/sites-available/iipserver.conf /usr/local/etc/nginx/sites-enabled/iipserver.conf -
Now edit the main nginx configuration file at
/usr/local/etc/nginxand insert the following (the important bit being the inclusion of thesites-enableddirectory):worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include /usr/local/etc/nginx/sites-enabled/*.conf; } -
We'll be using Supervisor to manage IIPImage. To install Supervisor, run
$ pip install supervisorIf you do not have
pipinstalled, first install it using$ brew install pip.(If running
$ supervisorctlreturnscommand not found, you may need to include/usr/local/share/pythonin your$PATH.) -
To configure supervisor, we'll be using the default configuration file. The shortcut to create the default configuration is:
$ echo_supervisord_conf > /usr/local/etc/supervisord.confWe must replace the last line of the file (the
filesoption of the[include]block) with the following:files=/usr/local/etc/supervisor/conf.d/*.confNow we need to configure IIPImage to work with supervisor, in
/usr/local/etc/supervisor/conf.d/iipserver.conf:$ mkdir -p /usr/local/etc/supervisor/conf.d $ touch /usr/local/etc/supervisor/conf.d/iipserver.confIn
iipserver.conf, insert the following, replacingYOURUSERNAMEHEREwith your short username:[fcgi-program:iipserver] command=/usr/local/share/iipimage/iipsrv.fcgi socket=unix:///tmp/iipserver.sock user=YOURUSERNAMEHERE autostart=true autorestart=unexpected redirect_stderr=true redirect_stdout=true -
Because the IIPImage binaries point to libraries that are not in their default location, issue the following command to point IIPImage at the fcgi library on our system:
$ install_name_tool -change /usr/lib/libfcgi.0.dylib /usr/local/lib/libfcgi.0.dylib iipsrv.fcgiTo test that this worked, we can do
otool -L iipsrv.fcgi -
We can now run our services!
$ supervisord $ nginx
In your browser, navigate to http://localhost:8001/fcgi-bin/iipserver.fcgi. You should now see the IIPImage splash page, indicating that the IIPImage server has been successfully installed and configured!
-
Install
mod_fcgiusing your package manager.$ brew tap homebrew/apache $ brew install mod_fastcgi -
We will now download the IIPImage JPEG2000 binaries appropriate for our operating system and move
iipsrv.fcgiinto an easily accessible location.First download and unzip
iipsrv-0.9.9-j2k-OSX.zipfrom https://code.google.com/p/oldmapsonline/downloads/list. Then cd to the location where you downloaded and unzipped the binaries:$ cd ~/Downloads/iipsrv-0.9.9-j2k-OSX $ sudo mkdir -p /Library/WebServer/Documents/fcgi-bin/ $ sudo cp iipsrv.fcgi /Library/WebServer/Documents/fcgi-bin/ -
We will now configure Apache to talk to IIPImage. The default location for the main configuration file under OS X's Apache installation is
/etc/apache2/httpd.conf.Use your favorite text editor to open
/etc/apache2/httpd.conf.First, we'll include mod_fcgi into our Apache configuration. You should see a whole lot of
LoadModulelines around line 55 of your config file. At the end of the block ofLoadModulelines, insert the following (being sure that the path tomod_fastcgi.soas installed by the package manager is valid):LoadModule fastcgi_module /usr/local/Cellar/mod_fastcgi/2.4.6/libexec/mod_fastcgi.soNow, to configure Apache with IIPImage, insert the following block below the default
<Directory />block:<Directory "/Library/WebServer/Documents/fcgi-bin"> AllowOverride None Options None Order allow,deny Allow from all Options +ExecCGI </Directory> AddHandler fastcgi-script .fcg .fcgi .fpl # Initialise the FCGI server - set some default values FastCgiServer /usr/local/share/iipimage/iipsrv.fcgi \ -initial-env LOGFILE=/tmp/iipsrv.log \ -initial-env VERBOSITY=2 \ -initial-env JPEG_QUALITY=50 \ -initial-env MAX_IMAGE_CACHE_SIZE=10 \ -initial-env MAX_CVT=3000Finally, we'll be changing the port that Apache will listen on. This is optional. Replace
Listen 80towards the top of the file with your chosen port. We'll be using port8001.Listen 8001 -
Because the IIPImage binaries point to libraries that are not in their default location, issue the following command to point IIPImage at the fcgi library on our system:
$ cd $ install_name_tool -change /usr/lib/libfcgi.0.dylib /usr/local/lib/libfcgi.0.dylib iipsrv.fcgiTo test that this worked, we can do
$ otool -L iipsrv.fcgi -
Now we will start Apache.
$ sudo apachectl startIf you navigate your browser to
localhost:8001(or justlocalhostif you did not change the listen port), you should now see the IIPImage initialization page. IIPImage is ready to go!
