Importante

La traduzione è uno sforzo comunitario a cui puoi unirti. Questa pagina è attualmente tradotta al 100.00%.

7. Server di sviluppo

Un’installazione e un deployment di produzione di QGIS Server di solito comporta la configurazione di un componente web server (ad esempio Apache o Nginx) che può inoltrare le richieste HTTP provenienti dai client all’applicazione binaria QGIS Server FastCGI.

Se vuoi testare rapidamente QGIS Server sulla tua macchina locale senza configurare e installare uno stack completo del server web, puoi usare il server QGIS Development Standalone.

Questa è un’applicazione indipendente che fornisce un server web molto semplice pronto a ospitare i file del tuo progetto.

Avvertimento

Il server di sviluppo standalone non è stato sviluppato con lo scopo di essere usato in produzione, non è stato controllato per le vulnerabilità di sicurezza o per altre condizioni di stress che normalmente si verificano su un server esposto pubblicamente.

Per avviare il server:

$ qgis_mapserver

La porta predefinita che il Development Server ascolta è 8000. Esempio in uscita:

QGIS Development Server listening on http://localhost:8000
CTRL+C to exit
127.0.0.1 [lun gen 20 15:16:41 2020] 5140 103ms "GET /wfs3/?MAP=/tests/testdata/qgis_server/test_project.qgs HTTP/1.1" 200
127.0.0.1 [lun gen 20 15:16:41 2020] 3298 2ms "GET /wfs3/static/jsonFormatter.min.js HTTP/1.1" 200
127.0.0.1 [lun gen 20 15:16:41 2020] 1678 3ms "GET /wfs3/static/jsonFormatter.min.css HTTP/1.1" 200
127.0.0.1 [lun gen 20 15:16:41 2020] 1310 5ms "GET /wfs3/static/style.css HTTP/1.1" 200
127.0.0.1 [lun gen 20 15:16:43 2020] 4285 13ms "GET /wfs3/collections?MAP=/tests/testdata/qgis_server/test_project.qgs HTTP/1.1" 200

Il server ha alcune opzioni che possono essere passate come argomenti della linea di comando. Puoi vederle tutte invocando il server con -h.

Usage: qgis_mapserver [options] [address:port]
QGIS Development Server

Options:
-h, --help        Displays this help.
-v, --version     Displays version information.
-l <logLevel>     Sets log level (default: 0)
                    0: INFO
                    1: WARNING
                    2: CRITICAL
-p <projectPath>  Path to a QGIS project file (*.qgs or *.qgz),
                    if specified it will override the query string MAP argument
                    and the QGIS_PROJECT_FILE environment variable

Arguments:
addressAndPort    Listen to address and port (default: "localhost:8000")
                    address and port can also be specified with the environment
                    variables QGIS_SERVER_ADDRESS and QGIS_SERVER_PORT