[Qgis-developer] QGIS Server - use PGSYSCONFDIR in a server with no postgresql installed

kimaidou kimaidou at gmail.com
Thu Nov 19 05:10:28 PST 2015


I just tested, and the file /etc/apache2/mods-enabled/env.conf  with
SetEnv PGSYSCONFDIR "/etc"

is indeed important. Commenting this line would lead to no connection
possible by QGIS Server, even if the env variable is correctly set in
fcgid.conf.

This is the first time I see this behaviour (fcgid.conf not setting
properly an env variable)

Michaël

2015-11-19 14:03 GMT+01:00 kimaidou <kimaidou at gmail.com>:

> Hi Andreas,
>
> It worked like a charm with your exact configuration.
>
> I will remove the env.conf file to see if it still works without this
> conf. If so, this would mean the pg_service.conf file situated in
> /etc/postgresql/ could not be read. Probably wrong permissions on the
> folder /etc/postgresql.
>
> Thanks again for your help
>
> I add a todo to remember adding this in QGIS Server documentation.
>
> Regards
> Michaël
>
> 2015-11-19 13:59 GMT+01:00 Neumann, Andreas <a.neumann at carto.net>:
>
>> Hi,
>>
>> Here are the properties of my pg_service.conf file:
>>
>> -rw-r--r-- 1 root root 809 Aug 13  2014 /etc/pg_service.conf
>>
>> Andreas
>>
>> On 2015-11-19 13:52, kimaidou wrote:
>>
>> Thanks Andreas for your help.
>>
>> I also think fcgid.conf is the "winner", but I will try your
>> configuration ( move pg_service.conf to /etc/ and add the setenv in Apache
>> env.conf ).
>> Could you please give me the result of
>>
>> ls -lh /etc/pg_service.conf
>>
>> command, so that I completely mimic your configuration ?
>>
>> Cheers,
>> Michaël
>>
>> 2015-11-19 13:00 GMT+01:00 Neumann, Andreas <a.neumann at carto.net>:
>>
>>> Hi Michaël,
>>>
>>> This works for me.
>>>
>>> My pg_service.conf file is at /etc/pg_service.conf
>>>
>>> And in the Apache configuration it is specified in two files:
>>>
>>> /etc/apache2/mods-enabled/env.conf :
>>>
>>> SetEnv PGSYSCONFDIR "/etc"
>>>
>>> and in
>>>
>>> /etc/apache2/mods-enabled/fcgid.conf
>>>
>>> FcgidInitialEnv PGSYSCONFDIR "/etc"
>>>
>>> I am not sure which one is really used or has precedence - I suspect it
>>> is the fcgid.conf file.
>>>
>>> Hope you get this working,
>>>
>>> Andreas
>>>
>>> On 2015-11-19 12:17, kimaidou wrote:
>>>
>>> Hi all
>>>
>>> I have installed QGIS Server in one server (called "map") and PostGreSQL
>>> on another (called "pg" ), both on Ubuntu Server 14.04
>>> I would like to access to database only with PostGreSQL services, so in
>>> the map server, I did the following steps:
>>>
>>> * Create a folder /etc/postgresql
>>> * Create a file /etc/postgresql/pg_service.conf  with some credentials
>>> * Install postgresql-client to be able to use psql
>>> * Add a environment variable PGSYSCONFDIR  and export it (plus add it in
>>> /etc/environment ). Variable : PGSYSCONFDIR=/etc/postgresq'l
>>> * Test via psql "service=myservice"  -> I can connect to the database
>>> and get data
>>>
>>> When I ask QGIS Server for the GetCapabilities, the layers configured
>>> with this service cannot be added. I get the error : "Service myservice not
>>> found"
>>>
>>> So I added the following line in the fcgid.conf file to explicitely tell
>>> Apache (and QGIS Server) to use this value.
>>> FcgidInitialEnv PGSYSCONFDIR "/etc/postgresql"
>>>
>>> But nothing works. I even tried to chmod and chown the service file and
>>> folder to let Apache user www-data to read it. I also tried with a quick
>>> and dirty chmod 777 , with no luck.
>>>
>>> Has anyone some experience in setting up a Server with no postgresql
>>> installed locally, and use the pg_service.conf file with QGIS Server ?
>>>
>>> Thanks a lot for any clue
>>> Michaël
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20151119/fe8e6163/attachment-0001.html>


More information about the Qgis-developer mailing list