[Qgis-developer] Use Nginx to serve QGIS Server ?

Larry Shaffer larrys at dakotacarto.com
Wed Nov 26 10:48:35 PST 2014


Hi Michael,

On Wed, Nov 26, 2014 at 8:30 AM, kimaidou <kimaidou at gmail.com> wrote:

> Hi list,
>
> I would like to try Nginx / php-fpm as a replacement of Apache / mod_fcgid
> for Lizmap Web Client. I have googled a bit and found that it shall be
> possible to do so. Cf links [1] and [2] below
>
> In [2], it seems that Larry would like to publish a recipe to achieve
> this.
>
> Larry, or anyone else, could point me toward the right direction ?
>

Yes, I can help with generating some recipes for serving QGIS Server,
beyond Apache. I would like to see recipes for nginx and lighttpd included.
Both require independent spawning of the FCGI binary as a separate process,
and lighttpd has good FastCGI support via its internal (or exernal)
spawn-fcgi utility. See links [0, 1, 2].

It is important to offer a solid, thoroughly tested nginx recipe as it is a
commonly available Web server nowadays, and it uses very little in the way
of resources (so good for low-RAM VPS setups). I personally don't serve any
maps to enough users to properly test heavy loads. Will need help from
other devs with load testing the recipes.

For nginx, you can also use spawn-fcgi (or fcgiwrap, etc.) but I have found
the uWSGI [3] process manager to work very well with nginx. uWSGI also is
beneficial for deploying the Python-based search functionality offered in
the QGIS Web Client. While there are only a few examples of
serving/spawning FastCGI under uWSGI (here's a simple one [4]), it is fully
supported like many of the other protocols in uWSGI.

IMO, uWSGI offers the most configurable and flexible process manager, and
can work well as a QGIS Server backend manager to almost any Web server
frontend, e.g. nginx, lighttpd, Cherokee, Apache, etc, and on all platforms.

Of note: I used a lighttpd/spawn-fcgi setup for doing the labeling tests
for Server. See [5, 6] (has some lightweight, non-production spawning
script samples for Debian and Mac). One reason for this setup choice is
that both tools now have a CMake build and could conceivably be a
dependency for embedding a Server instance *inside* of the QGIS desktop
application (for previewing Server output, without the need for any server
setup on the part of the user).

Concerning php-fpm, I believe that is only for managing a PHP FastCGI
implementation and is now part of PHP source. I don't think it can be used
to manage a QGIS Server process. It seems like a good fit for LizMap
server-side PHP scripting, though.

I also think it would be good to offer a tutorial on combining QGIS Server
with other tools, like MapProxy [7], which is readily installable alongside
OSGeo4W [8].

[0] http://wiki.nginx.org/FcgiExample
[1] http://chriswu.me/blog/writing-hello-world-in-fcgi-with-c-plus-plus/
[2] http://redmine.lighttpd.net/projects/spawn-fcgi/wiki
[3] https://uwsgi-docs.readthedocs.org/en/latest/
[4] http://stackoverflow.com/a/24380105/2865523

[5]
https://github.com/qgis/QGIS/tree/master/tests/testdata/qgis_local_server
[6]
https://github.com/qgis/QGIS/blob/master/tests/src/python/qgis_local_server.py

[7] http://mapproxy.org/
[8] http://mapproxy.org/docs/1.6.0/install_osgeo4w.html

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota


>
> [1] https://github.com/cccs-web/core/wiki/Install-QGIS-Server-under-Nginx
> [2] http://lists.osgeo.org/pipermail/qgis-user/2014-July/028267.html
>
> Thanks in advance,
>
> Michael
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141126/08f54896/attachment.html>


More information about the Qgis-developer mailing list