[Qgis-developer] QGIS Server Build Notes for Mac OS X

Marco Hugentobler marco.hugentobler at sourcepole.ch
Wed Jan 25 02:47:29 EST 2012


Hi Larry

Thanks for the detailed description. Hopefully it can be added to the 
documentation.

>*Possible bug*
>I was not able to get QGIS Server to GetMap with image/jpeg, only
>image/png. It always returned a server error. I believe this may be a
>bug in the source, or when building using Mr. Kyngesburye's
>frameworks, as this also occurred in the last QGIS he distributed with
>a built Server (1.7.0) [8]. Anyone else notice this?


Requesting images as jpeg from QGIS server works for me on my Linux box. 
Maybe it is something related to the libraries used E.g. a Qt without 
jpeg support?

Regards,
Marco




On 23.01.2012 00:32, Larry Shaffer wrote:
> Hi Devs,
>
> I have compiled QGIS and Server from the github 'master' branch on
> Snow Leopard and Lion and have a couple of suggestions for the
> step-by-step build instructions and noticed one possible bug. I have
> also tested the Server successfully with the QGIS Web Client on both
> OS.
>
> Concerning the QGIS Server build (-D WITH_MAPSERVER=TRUE in section
> 5.5), the current notes state that fastcgi support has been dropped in
> Lion and that adding that support is not recommended for the average
> user. However, I think adding this support back in is straightforward
> and not any harder than the rest of the build steps.
>
> Here is my suggestion for the build steps to add Server build support
> on Snow Leopard and Lion (not tested on older OS):
>
> 1) Download fastcgi library [1] and install (necessary for building
> qgis_mapserv.fcgi):
>
> cd<fastcgi-src-dir>
> ./configure --prefix=/usr/local
> make&&  sudo make install
>
> 2) Download Apache's mod_fcgid [2] and install (not included with
> Apache distribution by default):
>
> cd<mod-fcgid-src-dir>
> APXS=/usr/sbin/apxs ./configure.apxs
> make&&  sudo make install
>
> This automatically adds the 'LoadModule fcgid_module ...' line to
> /etc/apache2/httpd.conf file. In Snow Leopard, commenting out the old
> 'LoadModule fastcgi_module' line is advised.
>
> Both PostgreSQL server and mod_fcgid use the Mac's shared memory for
> spawned processes. The default settings for shared memory are too low
> to accommodate both programs; and trying to launch Apache now will
> cause it to terminate when mod_fcgid can not allocate shared memory
> that a running postgres process has already used up. The solution is
> to up the values of these shared memory settings. A good explanation
> of this is in the README included with PostgreSQL-for-Mac installer by
> Enterprise DB [3].
>
> 3) Add the file /etc/sysctl.conf with the following contents (as per
> PostgreSQL-for-Mac README):
>
> kern.sysv.shmmax=1610612736
> kern.sysv.shmall=393216
> kern.sysv.shmmin=1
> kern.sysv.shmmni=32
> kern.sysv.shmseg=8
>
> 4) Add an Apache virtual host config to support the
> ~/Applications/QGIS.app build (default fcgid settings work for
> testing/non-production server).
>
> Add /etc/apache2/other/qgis-mapserver-fcgid.conf  (replace
> /Users/<user>  with where QGIS was built, unless built to
> /Applications):
>
> <IfModule fcgid_module>
>    # on Mac install, not in logs/
>    FcgidIPCDir /var/run/fcgidsock
>    FcgidProcessTableFile /var/run/fcgid_shm
> 	
>    # fcgid settings for qgis_mapserv.fcgi, initially set to defaults
>    # see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
>    # add InitialEnv name[=value] 1 or more times to pass env variables
>    FcgidCmdOptions
> /Users/<user>/Applications/QGIS.app/Contents/MacOS/fcgi-bin/qgis_mapserv.fcgi
> \
>      ConnectTimeout 3 \
>      IdleTimeout 300 \
>      IOTimeout 40 \
>      MaxProcesses 100 \
>      MaxProcessLifeTime 3600 \
>      MaxRequestsPerProcess 0 \
>      MinProcesses 3
> 		
>    AddHandler fcgid-script .fcgi
>
>    Alias /fcgi-bin/ /Users/<user>/Applications/QGIS.app/Contents/MacOS/fcgi-bin/
>
>    <Directory /Users/<user>/Applications/QGIS.app/Contents/MacOS/fcgi-bin/>
>      AllowOverride None
>      Options ExecCGI
>      Order allow,deny
>      Allow from all
>    </Directory>
>
> </IfModule>
>
> 5) Restart Mac for sysctl settings to take affect (though they can be
> added dynamically with sysctl program). If not running, start Apache
> via the Web Sharing control under System Preferences/Sharing. The log
> /var/log/apache2/error_log should show something like:
>
> Apache/2.2.20 (Unix) ...other modules... mod_fcgid/2.3.6 configured --
> resuming normal operations
>
> Apple's decision to drop support for fastcgi_module seems to be
> appropriate as it is not being developed upon. While mod_fcgid is
> currently a supplemental Apache-supported module, an investigation of
> the Apache 2.3/4 documentation shows it is still not included by
> default. Although, mod_proxy_fcgi [4] looks like it will be included
> in the next distribution (same as current third party module? [5]).
> Using an fcgi process spawner like fcgistarter [6], then using Apache
> as a reverse proxy, appears to be a better, and more versatile
> solution in the future. I actually prefer to use spawn_fcgi [7] and
> Nginx as a reverse proxy on the Mac (via MacPorts) and on Ubuntu,
> instead of Apache, for running my QGIS Server.
>
> *Possible bug*
> I was not able to get QGIS Server to GetMap with image/jpeg, only
> image/png. It always returned a server error. I believe this may be a
> bug in the source, or when building using Mr. Kyngesburye's
> frameworks, as this also occurred in the last QGIS he distributed with
> a built Server (1.7.0) [8]. Anyone else notice this?
>
>
> [1] http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz  OR
> http://www.fastcgi.com/dist/fcgi-current.tar.gz
> [2] http://httpd.apache.org/download.cgi#mod_fcgid
> [3] http://www.enterprisedb.com/resources-community/pginst-guide#macosx AND
>       their http://www.enterprisedb.com/products-services-training/pgdownload#osx
> installer README
> [4] http://httpd.apache.org/docs/2.3/mod/mod_proxy_fcgi.html
> [5] http://mproxyfcgi.sourceforge.net/
> [6] http://httpd.apache.org/docs/2.3/programs/fcgistarter.html
> [7] http://redmine.lighttpd.net/projects/spawn-fcgi
> [8] http://www.kyngchaos.com/files/software/qgis/Qgis-1.7.0-3-Snow.dmg
>
>
> Best Regards,
>
> Larry Shaffer
> Dakota Cartography
> Black Hills, South Dakota
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


-- 
Dr. Marco Hugentobler
Sourcepole -  Linux&  Open Source Solutions
Churerstrasse 22, CH-8808 Pfäffikon SZ, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee



More information about the Qgis-developer mailing list