<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Alessandro,<br>
      <br>
      This is an interesting feature, but am I see right that it doesn't
      have any access rights restrictions?<br>
      <br>
      <br>
      Alessandro Pasotti wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAL5Q670LwXGF_+gxbOKh=r_v1iPbjfoem8j5MRZQqA1gAFz9nQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Another possibility: <a
            href="https://docs.qgis.org/3.34/en/docs/server_manual/catalog.html"
            moz-do-not-send="true">https://docs.qgis.org/3.34/en/docs/server_manual/catalog.html</a></div>
        <div><br>
        </div>
        <div>You will need co configure an env variable:
          QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS</div>
        <div><br>
        </div>
        <div>all projects stored in the connections above will be listed
          in the catalog.<br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Sep 6, 2024 at 4:26 PM
          Abel Gonzalez via QGIS-User <<a
            href="mailto:qgis-user@lists.osgeo.org"
            moz-do-not-send="true">qgis-user@lists.osgeo.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <p dir="ltr">Hi! I just installed QGIS server on my windows
            server under Apache HTTPD and postgres in the sabe server
            and works fine.  There after if you want to show the qgis
            projects on a map you should install QGIS Web Client or
            Lizmap. In order to serve WMS, WFS , etc qgis project should
            no be saved on postgis, otherwise will require extra
            configuration.<br>
            Good luck! <br>
            Abel</p>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">Den fre 6 sep. 2024
              16:09User Adminofff via QGIS-User <<a
                href="mailto:qgis-user@lists.osgeo.org" target="_blank"
                moz-do-not-send="true">qgis-user@lists.osgeo.org</a>>
              skrev:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF">
                <div style="font-family:monospace;font-size:13px"
                  lang="x-unicode">Hi, <br>
                  <br>
                  I'm trying to make QGIS Server to serve projects from
                  PostgreSQL database on the web. <br>
                  Could anyone tell me please, is it possible to do
                  that, or I can serve only files? <br>
                  <br>
                  The general workflow should look like this: <br>
                  <br>
                  1. Operators with QGIS Desktop are connecting to
                  PostgreSQL, and create/modify projects in it. <br>
                  No files are involved. This part works, I was able to
                  save test project on one system, and open it on the
                  other. <br>
                  <br>
                  2. After finishing project creation/modification,
                  Operators send a link to it to the
                  consumers/implementors. <br>
                  The idea is to be able to view the project in a
                  browser on any device. No editing is needed, at least
                  at this moment. <br>
                  I've installed QGIS Server on the same host as
                  PostgreSQL, set nginx/related stuff, and tested that
                  it successfully serves file project. <br>
                  Then I've tried to get the project from database. qgis
                  user, under which QGIS server is run, was allowed
                  passwordless connection to PostgreSQL via localhost. <br>
                  <br>
                  Having test URL for file like this <br>
                  <a
href="https://domain.com/qgisserver/cgi-bin/qgis_mapserv.fcgi?LAYERS=countries&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&WIDTH=400&HEIGHT=200&BBOX=-90,-180,90,180&MAP=/home/qgis/projects/world.qgs"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://domain.com/qgisserver/cgi-bin/qgis_mapserv.fcgi?LAYERS=countries&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&WIDTH=400&HEIGHT=200&BBOX=-90,-180,90,180&MAP=/home/qgis/projects/world.qgs</a>
                  <br>
                  <br>
                  I've replaced file path with naive PostgreSQL URL like
                  this <br>
                  <a
href="https://domain.com/qgisserver/cgi-bin/qgis_mapserv.fcgi?LAYERS=countries&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&WIDTH=400&HEIGHT=200&BBOX=-90,-180,90,180&MAP=postgresql://127.0.0.1:5432?sslmode=disable&dbname=qgis&schema=world&project=world"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://domain.com/qgisserver/cgi-bin/qgis_mapserv.fcgi?LAYERS=countries&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS=EPSG:4326&WIDTH=400&HEIGHT=200&BBOX=-90,-180,90,180&MAP=postgresql://127.0.0.1:5432?sslmode=disable&dbname=qgis&schema=world&project=world</a>
                  <br>
                  But got this error: <br>
                  <br>
                  <ServerException> <br>
                  Project file error. For OWS services: please provide a
                  SERVICE and a MAP parameter pointing to a valid QGIS
                  project file <br>
                  </ServerException> <br>
                  <br>
                  The error says that QGIS Server wants file, no
                  mentions about database. <br>
                  On other hand, documentation below says that for MAP
                  parameter either file path or PostgreSQL URL is
                  needed, so it should work? <br>
                  <br>
                  <a
href="https://docs.qgis.org/3.34/en/docs/server_manual/config.html#qgis-server-envvar"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://docs.qgis.org/3.34/en/docs/server_manual/config.html#qgis-server-envvar</a>
                  <br>
                  QGIS_PROJECT_FILE <br>
                  The .qgs or .qgz project file, normally passed as a
                  parameter in the query string (with MAP), you can also
                  set it as an environment variable (for example by
                  using mod_rewrite Apache module). <br>
                  <br>
                  **Note that you may also indicate a project stored in
                  PostgreSQL**, e.g.
postgresql://localhost:5432?sslmode=disable&dbname=mydb&schema=myschema&project=myproject
                  or inside a geopackage file, e.g.
                  geopackage:/path/to/geopackage/file.gpkg?projectName=myProjectName.
                  <br>
                  <br>
                  <br>
                  Searching in the Internet for the error above, I've
                  found this bug report <br>
                  <a href="https://github.com/qgis/QGIS/issues/31192"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://github.com/qgis/QGIS/issues/31192</a>
                  <br>
                  <br>
                  From which I've got the idea to encode PostgreSQL URL
                  in test URL, but it didn't work with the same error as
                  above. <br>
                  Also, it looks like report author is connecting with
                  QGIS Desktop to QGIS Server, not browser, so this is
                  not my case? <br>
                  Also-also, as I've stuck with nginx for unrelated to
                  QGIS reasons, I cannot test proposed there Apache
                  rewrite magic. <br>
                  <br>
                  I've tried to see if there is anything useful in QGIS
                  Server logs, but there are no any related messages in
                  them. <br>
                  I've set QGIS_SERVER_LOG_PROFILE to true, but that
                  didn't change anything. I see my request to QGIS
                  server only in nginx logs, but nothing in QGIS Server
                  logs, and no even failed connection attempts in
                  PostgreSQL logs. <br>
                  <br>
                  So, is there any way to have PostreSQL projects served
                  via QGIS Server, or I can use only files? <span
                    title=":)"></span> <br>
                </div>
              </div>
              _______________________________________________<br>
              QGIS-User mailing list<br>
              <a href="mailto:QGIS-User@lists.osgeo.org"
                rel="noreferrer" target="_blank" moz-do-not-send="true">QGIS-User@lists.osgeo.org</a><br>
              List info: <a
                href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
              Unsubscribe: <a
                href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
            </blockquote>
          </div>
          _______________________________________________<br>
          QGIS-User mailing list<br>
          <a href="mailto:QGIS-User@lists.osgeo.org" target="_blank"
            moz-do-not-send="true">QGIS-User@lists.osgeo.org</a><br>
          List info: <a
            href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
          Unsubscribe: <a
            href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
        </blockquote>
      </div>
      <br clear="all">
      <br>
      <span class="gmail_signature_prefix">-- </span><br>
      <div dir="ltr" class="gmail_signature">
        <div dir="ltr">
          <div>Alessandro Pasotti</div>
          <div>QCooperative:  <a href="https://www.qcooperative.net"
              target="_blank" moz-do-not-send="true">www.qcooperative.net</a><br>
          </div>
          ItOpen:   <a href="http://www.itopen.it" target="_blank"
            moz-do-not-send="true">www.itopen.it</a></div>
      </div>
    </blockquote>
    <br>
  </body>
</html>