qgis-server for ubuntu 14.05

At this point, we will give a short and simple sample installation how-to for a minimal working configuration using
Apache2 on Debian Squeeze (or with negligible variations on Ubuntu 14.04). Many other OSs provide packages
for QGIS Server, too. If you have to build it all from source, please refer to the URLs above.

Firstly, add the following debian GIS repository:

$ cat /etc/apt/sources.list.d/debian-gis.list
deb http://qgis.org/debian trusty main
deb-src http://qgis.org/debian trusty main
$ # Add keys
$ sudo gpg --keyserver keyserver.ubuntu.com --recv-key 3FF5FFCAD71472C4


QGIS User Guide, Release 2.14
$ sudo gpg --export --armor 3FF5FFCAD71472C4 | sudo apt-key add -


QGIS starting in non-interactive mode not supported.
You are seeing this message most likely because you have no DISPLAY environment variable set.


$ # Update package list 
$ sudo apt-get update && sudo apt-get upgrade


Now, install QGIS Server:
$ sudo apt-get install qgis-server python-qgis


Installation of a HelloWorld example plugin for testing the servers. You create a directory to hold server plugins. Thiswillbespecifiedinthevirtualhostconfigurationandpassedontotheserverthroughanenvironmentvariable:
$ sudo mkdir -p /opt/qgis-server/plugins 
$ cd /opt/qgis-server/plugins 
$ sudo wget https://github.com/elpaso/qgis-helloserver/archive/master.zip 


$ # In case unzip was not installed before: 
$ sudo apt-get install unzip 
$ sudo unzip master.zip 
$ sudo mv qgis-helloserver-master HelloServer


apt-get install apache2 libapache2-mod-fcgid


Install the Apache server in a separate virtual host listening on port 80. Enable the rewrite module to pass HTTP BASIC auth headers:
$ sudo a2enmod rewrite 
$ vim /etc/apache2/conf-available/qgis-server-port.conf 
  Listen 8081 
$ sudo a2enconf qgis-server-port


vim /etc/apache2/sites-available/001-qgis-server.conf
<VirtualHost *:8081>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/qgis-server-error.log
CustomLog ${APACHE_LOG_DIR}/qgis-server-access.log combined
# Longer timeout for WPS... default = 40
FcgidIOTimeout 120
FcgidInitialEnv LC_ALL "en_US.UTF-8"
FcgidInitialEnv PYTHONIOENCODING UTF-8
FcgidInitialEnv LANG "en_US.UTF-8"
FcgidInitialEnv QGIS_DEBUG 1
FcgidInitialEnv QGIS_SERVER_LOG_FILE /tmp/qgis-000.log
FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0
FcgidInitialEnv QGIS_PLUGINPATH "/opt/qgis-server/plugins"
# Needed for QGIS HelloServer plugin HTTP BASIC auth
<IfModule mod_fcgid.c>
RewriteEngine on
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +FollowSymLinks
# for apache2 > 2.4
Require all granted
#Allow from all
</Directory>
</VirtualHost>


Now enable the virtual host and restart Apache:
$ sudo a2ensite 001-qgis-server
$ sudo service apache2 restart




http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

猜你喜欢

转载自blog.csdn.net/weixin_42151684/article/details/80227038