(this has only been tested on windows server 2016 but theres no reason it shouldnt work on 7, 8, 10, 2008 & 2012)
- install CGI in IIS (https://docs.microsoft.com/en-us/iis/configuration/system.webserver/cgi)
- install python 2.7.* for Windows (https://www.python.org/downloads/). Making sure to enable the 'Set Path' option in the installer and install for all users. I would recommend installing to 'c:\python27'.
- open an elevated powershell window. (Command prompt will work fine aswell without the './' in the commands below)
- type 'pip install virtualenv' + enter. this installs the python virtual environment module.
- create a virtual environment for mapproxy by typing 'virtualenv [TARGETDIR]' + enter. where TARGETDIR is the directory youd like to install to. example: virtualenv c:\inetpub\mapproxy
- type 'cd [TARGETDIR]\scripts' + enter
- type './activate' + enter. powershell should now have the virtualenv name appended to the prompt e.g.
(mapproxy) PS C:\inetpub\[TARGETDIR]\Scripts>
- type 'pip install mapproxy' + enter
- download and install the Microsoft Visual C++ Compiler for Python 2.7 from http://aka.ms/vcpython27
- type 'pip install pyproj' + enter
- type 'pip install wfastcgi' + enter
- to test mapproxy is working type 'mapproxy-util --version' + enter. should display version number like 'MapProxy 1.11.0'
- type 'mapproxy-util create -t base-config c:\inetpub\[TARGETDIR]\[APPNAME]' + enter. where [APPNAME] is the name of your appilcation. This creates the mapproxy demo yaml files.
- type 'mapproxy-util create -t wsgi-app -f c:\inetpub\[TARGETDIR]\[APPNAME]\mapproxy.yaml c:\inetpub[TARGETDIR][APPNAME]\config.py'. where [APPNAME] is the name of your appilcation from the previous step. this will create a simple WSGI app config file.
- type 'mapproxy-util create -t log-ini c:\inetpub[TARGETDIR][APPNAME]\log.ini'. This creates the logging config file.
- open 'c:\inetpub\[TARGETDIR]\[APPNAME]\config.py' with notepad and change 'application = make_wsgi_app(...' to 'app = make_wsgi_app(...' and uncomment the lines below.
# from logging.config import fileConfig
# import os.path
# fileConfig(r'c:\inetpub\[TARGETDIR]\[APPNAME]/log.ini', {'here': os.path.dirname(__file__)})
config.py should read something like this
from logging.config import fileConfig
import os.path
fileConfig(r'c:\inetpub\[TARGETDIR]\[APPNAME]\log.ini', {'here': os.path.dirname(__file__)})
from mapproxy.wsgiapp import make_wsgi_app
app = make_wsgi_app(r'c:\inetpub\[TARGETDIR]\[APPNAME]\mapproxy.yaml')
- open IIS and goto 'FastCGI Settings' for the server. Add an application with:
FULL PATH=C:\inetpub\[TARGETDIR]\Scripts\python.exe
ARGUMENTS=C:\inetpub\[TARGETDIR]\Lib\site-packages\wfastcgi.py
- once saved 'Edit...' the new 'FastCGI' entry and add the following 'Environmental Variables'
PYTHONPATH=C:\inetpub\[TARGETDIR]\Scripts\
WSGI_HANDLER=config.app
- in IIS manager add a new site with any name and 'c:\inetpub\[TARGETDIR]\[APPNAME]' as the physical path (https://docs.microsoft.com/en-au/iis/get-started/getting-started-with-iis/create-a-web-site)
- in the new site settings goto 'Handler Mappings' and 'Add Module Mapping...' using settings below
Request Path = *
Module = FastCgiModule
Executable Path = c:\inetpub\[TARGETDIR]\scripts\python.exe|c:\inetpub\[TARGETDIR]\lib\site-packages\wfastcgi.py
Name = WSGI
Request Restrictions > 'Invoke handler only if request is mapped to' = unchecked
- change file permissions for 'C:\inetpub\[TARGETDIR]' to give 'Full Control' to user group 'IIS_USRS'. Including child objects.
- right click on the site in IIS and click 'Manage Site > Browse' and you should see the mapproxy demo site. These settings can be viewed and changed in the mapproxy.yaml file.