<div dir="ltr"><br>
<div class="gmail_quote"><h2>Light Speed Map Server</h2>
        <p style="text-align: justify;">This is a configuration of <a href="http://mapserver.org?by-user=t" rel="nofollow" link="external" target="_blank">Map Server</a> <span>WMS</span> as <a href="http://www.fastcgi.com?by-user=t" rel="nofollow" link="external" target="_blank">fast-cgi</a> module of <a href="http://www.lighttpd.net?by-user=t" rel="nofollow" link="external" target="_blank">Lighttpd</a>. Here I am compiling all main software packages from the source code on a 64bit Linux operating system to get maximum performance. I hope my readers having experience in installing & configuring software packages under Linux platform. I prefer a <a href="http://www.centos.org?by-user=t" rel="nofollow" link="external" target="_blank">CentOS 5.4 ×86_64</a> Linux minimal server installation, because it is quite stable for me so far.</p>
        <h4 style="text-align: justify;">Prerequisites</h4>
        <p style="text-align: justify;">Make sure that you have installed the following packages, normally it comes with the operating system installation.</p><p><span><h4>cc gcc-c++ python python-devel krb5-devel readline-devel make swig pcre-devel libpng libpng-devel bzip2-devel fontconfig fontconfig-devel libxml2-devel penssl-devel curl-devel giflib-devel zlib-devel gettext libjpeg-devel libtiff-devel</h4>
</span></p><br>
If any of the package is not installed, install it by using <span>YUM</span>. For example if gcc is missing <p><span><h4>yum install gcc-c++</h4></span></p><br>
Ok, let’s start with the main software packages installation for Map Server,
        <h4>PostgresSQL</h4>
        <p style="text-align: justify;">The world’s most advanced open source database server.I prefer <a href="http://www.postgresql.org?by-user=t" rel="nofollow" link="external" target="_blank">PostgresSQL</a> server to store the vector map data, for fast searching and rendering of <span>WMS</span> map tiles.<br>
<a href="http://nishad.us/docs/softwares/postgresql-8.4.2.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration.<br>
</p><p><span><h4>tar -xzf postgresql-8.4.2.tar.gz<br>
cd postgresql-8.4.2/<br>
./configure —prefix=/usr/local/pgsql —with-perl —with-python —with-krb5<br>
make<br>
make install<br>
adduser postgres<br>
mkdir /var/lib/pgsql<br>
chown -R postgres /var/lib/pgsql<br>
su postgres<br>
/usr/local/pgsql/bin/initdb -D /var/lib/pgsql/data<br>
/usr/local/pgsql/bin/postgres -i -h localhost -p 5432 -D /var/lib/pgsql/data &</h4></span></p>
        <p style="text-align: justify;">Now your PostgreSQL server is up and running. If you need an init.d startup script, download it from here <a href="http://nishad.us/docs/softwares/postgresql.txt" rel="nofollow" link="external" target="_blank">/etc/init.d/postgresql</a> </p>
        <h4>FastCGI </h4>
        <p style="text-align: justify;"><a href="http://www.fastcgi.com?by-user=t" rel="nofollow" link="external" target="_blank">FastCGI</a> is a protocol for interfacing interactive programs with a web server. This is a variation on the earlier Common Gateway Interface (<span>CGI</span>). Unlike <span>CGI</span>, It cannot duplicates the universality of <span>CGI</span> overnight. It runs applications in processes isolated from the core Web server, which provides greater security than <span>API</span>s. Not only does FastCGI restore the strengths of <span>CGI</span>, it also adds two new benefits like Distributed computing and Multiple extensible roles.<br>
<a href="http://nishad.us/docs/softwares/fcgi-2.4h4" rel="nofollow" link="external" target="_blank">Download the source</a>. <span>PROJ</span>.4</p>
        <p><a href="http://trac.osgeo.org/proj/" rel="nofollow" link="external" target="_blank">Proj.4</a> is Cartographic Projections library is designed as a standard Unix filter utility to be employed with other pro-grams in the generation of maps and charts and, in many cases, used in map digitizing applications for conversion of State Plane Coordinate Systems to and from geographic coordinates.</p>
        <p><a href="http://nishad.us/docs/softwares/proj-4.7.0.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf proj-4.7.0.tar.gz <br>
cd proj-4.7.0/<br>
./configure —prefix=/usr/local/<br>
make<br>
make install<br>
</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled the Proj4 libraries required for Map Server..0.tar.gz</p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf fcgi-2.4.0.tar.gz <br>
cd fcgi-2.4.0/<br>
./configure —prefix=/usr/local/<br>
make<br>
make install</h4></span></p>
        <p style="text-align: justify;">You have installed the FastCGI executables and libraries now, we will use this later while configuring the Map Server.</p>
        <h4>LighHTTPD</h4>
        <p style="text-align: justify;"><a href="http://www.lighttpd.net/" rel="nofollow" link="external" target="_blank">Lighttpd</a> is a web server designed and optimized for high performance environments, with a small memory footprint compared to other web-servers and effective management of the cpu-load. This is a perfect solution for every server which is suffering load problems. </p>
        <p><a href="http://nishad.us/docs/softwares/lighttpd-1.4.26.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf lighttpd-1.4.26.tar.gz <br>
cd lighttpd-1.4.26/<br>
p<>. ./configure —prefix /usr/local/ —bindir=/usr/local/bin/ —sbindir=/usr/local/sbin/ —libexecdir=/usr/local/libexec/ —libdir=/usr/local/lib/ —includedir=/usr/local/include —sysconfdir=/usr/local/lighthttpd —datarootdir=/var/www/ —datadir=/var/www —with-memcache<br>
make<br>
make install<br>
install -Dp ./doc/lighttpd.conf /etc/lighttpd/lighttpd.conf<br>
sed -e ‘s/FOO/lighttpd/g’ doc/rc.lighttpd.redhat > /etc/init.d/lighttpd<br>
chmod a+rx /etc/init.d/lighttpd<br>
/etc/init.d/lighttpd start<br>
</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled and configured your fast & secure Lighttpd web server.</p>
        <h4><span>PROJ</span>.4</h4>
        <p><a href="http://trac.osgeo.org/proj/" rel="nofollow" link="external" target="_blank">Proj.4</a> is Cartographic Projections library is designed as a standard Unix filter utility to be employed with other pro-grams in the generation of maps and charts and, in many cases, used in map digitizing applications for conversion of State Plane Coordinate Systems to and from geographic coordinates.</p>
        <p><a href="http://nishad.us/docs/softwares/proj-4.7.0.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf proj-4.7.0.tar.gz <br>
cd proj-4.7.0/<br>
./configure —prefix=/usr/local/<br>
make<br>
make install<br>
</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled the Proj4 libraries required for Map Server.</p>
        <h4>FreeType</h4>
        <p><a href="http://www.freetype.org/" rel="nofollow" link="external" target="_blank">FreeType</a> is a software font engine that is designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output. It can be used in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well.</p>
        <p><a href="http://nishad.us/docs/softwares/freetype-2.3.12.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf freetype-2.3.12.tar.gz <br>
cd freetype-2.3.12/<br>
./configure —prefix=/usr/local/<br>
make<br>
make install</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled the FreeType libraries required for Map Server.</p>
        <h4><span>GEOS</span></h4>
        <p><a href="http://trac.osgeo.org/geos/" rel="nofollow" link="external" target="_blank">Geos</a> <span>GEOS</span> is a Geometry Engine which aims to contain the complete functionality of Java Topology Suite. This includes all the <span>GIS</span> Simple Features for <span>SQL</span> spatial predicate functions and spatial operators, as well as specific <span>JTS</span> enhanced topology functions. </p>
        <p><a href="http://nishad.us/docs/softwares/geos-3.2.0.tar.bz2" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xjf geos-3.2.0.tar.bz2 <br>
cd geos-3.2.0/<br>
./configure —prefix=/usr/local/ —enable-python —enable-swig<br>
make<br>
make install</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled the Geos libraries required for Map Server.</p>
        <h4>GD</h4>
        <p><a href="http://www.libgd.org?by-user=t" rel="nofollow" link="external" target="_blank">GD</a> is used for dynamic creation of images like <span>PNG</span>, <span>JPEG</span> and <span>GIF</span> images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. </p>
        <p><a href="http://nishad.us/docs/softwares/gd-2.0.35.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf gd-2.0.35.tar.gz<br>
cd gd-2.0.35/<br>
./configure —prefix=/usr/local/ —with-png=/usr/ —with-jpeg=/usr/local/ —with-fontconfig=/usr/<br>
make<br>
make install</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled the GD binaries and it’s libraries required for Map Server. </p>
        <h4><span>PHP</span></h4>
        <p><a href="http://php.net?by-user=t" rel="nofollow" link="external" target="_blank"><span>PHP</span></a> is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into <span>HTML</span>. Here we are configuring <span>PHP</span> with PostgreSql and GD with is required for <span>PHP</span> mapscript, and compiling as fast-cgi to get the maximum security and speed. </p>
        <p><a href="http://nishad.us/docs/softwares/php-5.3.2.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf php-5.3.2.tar.gz<br>
cd php-5.3.2/<br>
./configure —prefix=/usr/local/php5 —with-fastcgi=/usr/local —with-regex=php —enable-debug —enable-magic-quotes —enable-libgcc —with-libxml-dir=/usr/local/ —with-openssl=/usr —with-kerberos=/usr/local/ —with-zlib=/usr —with-bz2=/usr/local/ —with-curl=/usr/local/ —with-gettext=/usr/local/ —enable-mbstring —with-pgsql=/usr/local/pgsql/ —enable-soap —enable-zip —with-gd=/usr/local/ —with-jpeg-dir=/usr/local/ —with-png-dir=/usr/local/ —with-mhash=/usr/local/<br>
make<br>
make install<br>
cp -pr php.ini-production /usr/local/php5/lib/php.ini</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled <span>PHP</span> as fast-cgi in the server. </p>
        <h4>PostGIS</h4>
        <p><a href="http://postgis.refractions.net/" rel="nofollow" link="external" target="_blank">PostGIS</a> PostGIS adds support for geographic objects to the PostgreSQL object-relational database. In effect, PostGIS “spatially enables” the PostgreSQL server, allowing it to be used as a backend spatial database for geographic information systems (<span>GIS</span>).</p>
        <p><a href="http://nishad.us/docs/softwares/postgis-1.5.1.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf softwares/postgis-1.5.1.tar.gz<br>
cd postgis-1.5.1/<br>
./configure —prefix=/usr/local/ —with-geosconfig=/usr/local/bin/geos-config —with-pgsql=/usr/local/pgsql/bin/pg_config<br>
make<br>
make install</h4></span></p>
        <p style="text-align: justify;">You have successfully configured postGIS with PostgreSQL and Geos, compiled the source and installed the binaries. Now you create a PostgreSQL database and spatially enables it by importing the PostGIS sql functions.</p>
<p><span><h4>createdb -U postgres testgis<br>
createlang -U postgres plpgsql testgis<br>
psql -U postgres testgis < postgis/postgis.sql<br>
psql -U postgres testgis < spatial_ref_sys.sql<br>
</h4></span></p>
        <h4><span>GDAL</span></h4>
        <p><a href="http://www.gdal.org?by-user=t" rel="nofollow" link="external" target="_blank"><span>GDAL</span></a> (Geospatial Data Abstraction Library) is a library for reading and writing raster geospatial data formats. As a library, it presents a single abstract data model to the calling application for all supported formats. It may also be built with a variety of useful command-line utilities for data translation and processing.</p>
        <p><a href="http://nishad.us/docs/softwares/gdal-1.7.1.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf gdal-1.7.1.tar.gz<br>
cd gdal-1.7.1/<br>
./configure —prefix=/usr/local/ —with-png=/usr/ —with-libtiff=/usr/local/ —with-jpeg=/usr/local/ —with-gif=/usr/ —with-pg=/usr/local/pgsql/bin/pg_config —with-geos=/usr/local/ —with-python<br>
make<br>
make install</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled Gdal with png,tiff,jpeg,gif,PostgreSQL and python. Now your Gdal library is available to build the Map Server.</p>
        <h4>Map Server</h4>
        <p><a href="http://mapserver.org?by-user=t" rel="nofollow" link="external" target="_blank">Map Server</a> MapServer is geographic data rendering engine, providing spatial context where needed. It allows you to create geographic image maps that can direct users to content. It was originally developed by the University of Minnesota (<span>UMN</span>) ForNet project in cooperation with <span>NASA</span>. The main features are,
        </p><ul>
                <li>Advanced cartographic output</li>
                <li>Scale dependent feature drawing and application execution</li>
                <li>Feature labeling including label collision mediation</li>
                <li>Fully customizable, template driven output</li>
                <li>TrueType fonts</li>
                <li>Map element automation (scalebar, reference map, and legend)</li>
                <li>Thematic mapping using logical- or regular expression-based classes</li>
                <li>Support for popular scripting and development environments, ie <span>PHP</span>, Python, Perl, Ruby, Java.</li>
                <li>Cross-platform support</li>
                <li>Support of numerous Open Geospatial Consortium (<span>OGC</span>) standards, ie <span>WMS</span>,WFS, <span>WMC</span>, <span>WCS</span>, Filter Encoding, <span>SLD</span>, <span>GML</span>, <span>SOS</span>, OM</li>
                <li>A multitude of raster and vector data formats, ie <span>TIFF</span>/GeoTIFF, EPPL7, <span>ESRI</span> shapfiles, PostGIS, <span>ESRI</span> ArcSDE, Oracle Spatial, MySQL</li>
                <li>On-the-fly map projection with 1000s of projections through the Proj.4 library.</li>
        </ul>
        <p><a href="http://nishad.us/docs/softwares/mapserver-5.6.1.tar.gz" rel="nofollow" link="external" target="_blank">Download the source</a></p>
        <p>Installation & Configuration<br>
</p><p><span><h4>tar -xzf mapserver-5.6.1.tar.gz<br>
cd mapserver-5.6.1/<br>
./configure —prefix=/usr/local/ —with-gdal=/usr/local/bin/gdal-config —with-ogr=/usr/local/bin/gdal-config —with-httpd=/usr/local/sbin/lighttpd —with-curl=/usr/bin/curl-config —enable-debug —with-proj=/usr/local/ —with-tiff=/usr/ —with-gd=/usr/local/ —with-jpeg=/usr/local/ —with-freetype=/usr/local/ —with-threads —with-postgis=/usr/local/pgsql/bin/pg_config —with-xml2-config=/usr/bin/xml2-config —with-png=/usr/ —with-wmsclient —with-wmsserver —with-fastcgi=/usr/local/ —with-wfs with-wfsclient —with-gif=/usr/ —with-geos=/usr/local/bin/geos-config —with-php=/usr/local/php5<br>
make<br>
make install<br>
cp -pr mapserv /var/www/cgi-bin/</h4></span></p>
        <p style="text-align: justify;">You have successfully compiled the Map Server with all it’s prerequisites and bindings,and as fast-cgi binary. Now you can test your installation by running “mapserv” binary. If you get below output, it seems your installation is successful.</p>
<p><span><h4><br>
./mapserv -v<br>
MapServer version 5.6.1 <span>OUTPUT</span>=GIF <span>OUTPUT</span>=PNG <span>OUTPUT</span>=JPEG <span>OUTPUT</span>=WBMP <span>OUTPUT</span>=SVG <span>SUPPORTS</span>=PROJ <span>SUPPORTS</span>=AGG <span>SUPPORTS</span>=FREETYPE <span>SUPPORTS</span>=ICONV <span>SUPPORTS</span>=WMS_SERVER <span>SUPPORTS</span>=WMS_CLIENT <span>SUPPORTS</span>=WFS_SERVER <span>SUPPORTS</span>=FASTCGI <span>SUPPORTS</span>=THREADS <span>SUPPORTS</span>=GEOS <span>INPUT</span>=TIFF <span>INPUT</span>=EPPL7 <span>INPUT</span>=POSTGIS <span>INPUT</span>=OGR <span>INPUT</span>=GDAL <span>INPUT</span>=SHAPEFILE</h4>
</span></p>
        <p><span>PHP</span> & Map server FastCGI configuration with Lighttpd. Edit Lighttpd.conf,</p>
<p><span><h4>vi /etc/lighttpd/lighttpd.conf</h4></span></p><br>
and insert below configuration under the fastcgi section.<br>
<p><span><h4>fastcgi.server = ( “.php” =><br>
( “localhost” =><br>
(<br>
“socket” => “/tmp/php-fastcgi.socket”,<br>
“bin-path” => “/usr/local/php5/bin/php-cgi”<br>
)<br>
),<br>
“/map” =><br>
( “localhost” =><br>
(<br>
“socket” => “/tmp/mapserver-fastcgi.socket”,<br>
“bin-path” => “/var/www/cgi-bin/mapserv”,<br>
“max-procs” => 1,<br>
“check-local” => “disable”<br>
)<br>
)<br>
)</h4></span></p><br>
Restart your Lighttpd server.<br>
<p><span><h4>/etc/init.d/lighttpd restart<br>
</h4></span></p>
        <p>Your Light Speed FastCGI Map Server Web Map Service(<span>WMS</span>) is up and running now. :) Try it from the <span>URL</span> <a href="http://localhost/maps?map=yourmapfile.map" rel="nofollow" link="external" target="_blank">http://localhost/maps?map=yourmapfile.map</a></p>
        <p>Contact me for any further help.</p>
        <p>Nishad Aliyar<br>
<a href="mailto:nishad.n.a@gmail.com" target="_blank">nishad.n.a@gmail.com</a><br>
</p><br></div><br></div>