docs/sources/tutorials/iis/index.md
If you want Grafana to be a subpath/subfolder under a website in IIS then the Application Request Routing (ARR) and URL Rewrite modules for ISS can be used to support this.
Example:
Grafana as a subpath: http://yourdomain.com:8080/grafana
Other Examples:
Install the URL Rewrite module for IIS.
You will also need the Application Request Routing (ARR) module for IIS for proxy forwarding
The Grafana config can be set by creating a file named/editing the existing file named custom.ini in the conf subdirectory of your Grafana installation. See the installation instructions for more details.
Using the example from above, if the subpath is grafana (you can set this to whatever is required) and the parent site is yourdomain.com:8080, then you would add this to the custom.ini config file:
[server]
domain = yourdomain.com:8080
root_url = %(protocol)s://%(domain)s/grafana/
Restart the Grafana server after changing the config file.
Configured address to serve Grafana: http://yourdomain.com:8080/grafana
If you already have a subpath on your domain, configure it as follows:
[server]
domain = yourdomain.com/existingsubpath
root_url = %(protocol)s://%(domain)s/grafana/
Restart the Grafana server after changing the config file.
Configured address to serve Grafana: http://yourdomain.com/existingsubpath/grafana
Server Proxy Settings action on the right-hand paneEnable proxy checkbox so that it is enabledApply and proceed with the URL Rewriting configurationNote: If you don't enable the Forward Proxy, you will most likely get 404 Not Found if you only apply the URL Rewrite rule
{{< figure src="/static/img/docs/tutorials/IIS_admin_console.png" max-width="800px" >}}
Add Rule(s)... action{{< figure src="/static/img/docs/tutorials/IIS_add_inbound_rule.png" max-width="800px" >}}
grafana(/)?(.*) (if you have customised the subpath that will be used, use that instead of grafana)Ignore case checkboxhttp://localhost:3000/{R:2}Append query string checkboxStop processing of subsequent rules checkbox{{< figure src="/static/img/docs/tutorials/IIS_url_rewrite.png" max-width="800px" >}}
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/proxy -preserveHostHeader:true /commit:apphostFinally, navigate to http://yourdomain.com:8080/grafana and you should come to the Grafana login page.
When navigating to the Grafana URL (http://yourdomain.com:8080/grafana) and a HTTP Error 404.0 - Not Found error is returned, then either:
Test pattern... button, test the part of the URL after http://yourdomain.com:8080/ and make sure it matches. For grafana/login the test should return 3 capture groups: {R:0}: grafana {R:1}: / and {R:2}: login.root_url setting in the Grafana config file does not match the parent URL with subpath.{{< figure src="/static/img/docs/tutorials/IIS_proxy_error.png" max-width="800px" >}}
The root_url setting in the Grafana config file does not match the parent URL with subpath. This could happen if the root_url is commented out by mistake (; is used for commenting out a line in .ini files):
; root_url = %(protocol)s://%(domain)s/grafana/
or if the subpath in the root_url setting does not match the subpath used in the pattern in the Inbound Rule in IIS:
root_url = %(protocol)s://%(domain)s/grafana/
pattern in Inbound Rule: wrongsubpath(/)?(.*)
or if the Rewrite URL in the Inbound Rule is incorrect.
The Rewrite URL should not include the subpath.
The Rewrite URL should contain the capture group from the pattern matching that returns the part of the URL after the subpath. The pattern used above returns three capture groups and the third one {R:2} returns the part of the URL after http://yourdomain.com:8080/grafana/.
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/proxy -preserveHostHeader:true /commit:apphost