diff --git a/rpm/sources/qgis-server-README.fedora b/rpm/sources/qgis-server-README.fedora index c2f4ff8760b..0c7c34dd9b7 100644 --- a/rpm/sources/qgis-server-README.fedora +++ b/rpm/sources/qgis-server-README.fedora @@ -25,8 +25,10 @@ QGIS project is "/var/www/ows/my_qgis_project.qgs". The sample configuration automatically adds the project file extension for you. The actual data can stay where it is. Make sure QGIS server can -access the project file and don't forget to let Httpd reload its -configuration before sending your requests! +access the project file and don't forget to let the web server reload its +configuration before sending your requests! Make also sure that +the environment variable 'QGIS_PREFIX_PATH' is set to '/usr' before +running the FCGI server; see the examples for further details. Please fill in the metadata tab for your QGIS project. diff --git a/rpm/sources/qgis-server-fcgi.service b/rpm/sources/qgis-server-fcgi.service index 09138b3976f..2d3addcc41e 100644 --- a/rpm/sources/qgis-server-fcgi.service +++ b/rpm/sources/qgis-server-fcgi.service @@ -10,6 +10,10 @@ After = network.target qgis-server-fcgi.socket # An existing user must be set User = qgis Group = qgis +Environment = "QGIS_PREFIX_PATH=/usr" "QGIS_SERVER_LOG_STDERR=true" +# See https://docs.qgis.org//en/docs/user_manual/working_with_ogc/server/config.html +# for the full list of supported environment variables, i.e.: +# Environment = "QGIS_SERVER_PARALLEL_RENDERING=true" ExecStart = /usr/libexec/qgis/qgis_mapserv.fcgi StandardInput = socket WorkingDirectory = /tmp diff --git a/rpm/sources/qgis-server-httpd.conf b/rpm/sources/qgis-server-httpd.conf index 29609322ebc..ab0b461fd2b 100644 --- a/rpm/sources/qgis-server-httpd.conf +++ b/rpm/sources/qgis-server-httpd.conf @@ -10,6 +10,10 @@ ScriptAlias /qgis/ "/usr/libexec/qgis/" Options ExecCGI Options FollowSymLinks + FcgidInitialEnv QGIS_PREFIX_PATH=/usr + # See https://docs.qgis.org//en/docs/user_manual/working_with_ogc/server/config.html + # for the full list of supported environment variables, i.e.: + # FcgidInitialEnv QGIS_SERVER_PARALLEL_RENDERING=true # Apache 2.4 diff --git a/rpm/sources/qgis-server-nginx.conf b/rpm/sources/qgis-server-nginx.conf index bd377fdc926..64cc2d7f99c 100644 --- a/rpm/sources/qgis-server-nginx.conf +++ b/rpm/sources/qgis-server-nginx.conf @@ -22,24 +22,26 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; - # Get 'port' from `$http_host` + # Get 'host' from `$host` unless 'X-Forwarded-Host' + # is set by the reverse proxy. + # 'X-Forwarded-Host' may contain also the port, + # so it is removed from the variable + map $http_x_forwarded_host $qgis_host { + "~(?[^:]+)" $h; + default $host; + } + # Get 'PORT' from `$http_host` map $http_host $port { "~*.*:(?

.*)" $p; - default server_port; + default $server_port; } - # Get 'proto' from `$scheme` unless 'X-Forwarded-Proto' - # is set by the reverse proxy - map $http_x_forwarded_proto $qgis_proto { - "" $scheme; - default $http_x_forwarded_proto; + # Get 'HTTPS' status from `$https` unless 'X-Forwarded-Proto' + # is set by the reverse proxy and contains 'https' scheme + map $http_x_forwarded_proto $qgis_ssl { + "https" "on"; + default $https; } - # Get 'host' from `$host` unless 'X-Forwarded-Host' - # is set by the reverse proxy - map $http_x_forwarded_host $qgis_host { - "" $host; - default $http_x_forwarded_host; - } - # Get 'port' from `$port` unless 'X-Forwarded-Port' + # Get 'PORT' from `$port` unless 'X-Forwarded-Port' # is set by the reverse proxy map $http_x_forwarded_port $qgis_port { "" $port; @@ -63,9 +65,10 @@ http { fastcgi_param QUERY_STRING $query_string; # build links in GetCapabilities based on # the hostname exposed by the reverse proxy - fastcgi_param SERVER_PROTOCOL $qgis_proto; + fastcgi_param HTTPS $qgis_ssl; fastcgi_param SERVER_NAME $qgis_host; fastcgi_param SERVER_PORT $qgis_port; + include fastcgi_params; } error_page 404 /404.html; location = /40x.html {