2

I want to add a Reverse Proxy to the Web Server that I'm using for Nextcloud, so that whenever I go to my-server.com, the web server points to Nextcloud, but when I go to my-server.com/grafana, the web server points at the port where Grafana is installed in my server (i.e., localhost:3000).

I have added the Proxy configuration to Apache as per the official documentation, and I've made sure that both mod_proxy and mod_proxy_http are enabled as suggested here

When I tried to test this i.e., by browsing to my-server.com/grafana, the address automatically changes to my-server.com/login and gives the 500 Error.

I've consulted this question and the official Grafana documentation

Here is how Apache conf. looks like (apart from the Nextcloud configuration):

ProxyRequests Off
ProxyPreserveHost On
ProxyPass /grafana http://localhost:3000
ProxyPassReverse /grafana http://localhost:3000

Here is how Grafana.ini looks like:

;protocol = https
;http_port = 3000
;domain = my-server.com
;root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
;serve_from_sub_path = true
;cert_file = /etc/letsencrypt/live/my-server.com/fullchain.pem
;cert_key = /etc/letsencrypt/live/my-server.com/privkey.pem

And here is the Apache log showing the error:

{"reqId":"YcFZWLtWXHPZ61fywIXx","level":3,"time":"2022-03-22T18:40:36+01:00","remoteAddr":"xxx.xxx.xxx.xxx","user":"--","app":"index","method":"GET","url":"/login","message":{"Exception":"Exception","Message":"The requested uri(/login) cannot be processed by the script '/nextcloud/index.php')","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/base.php","line":937,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Request.php","Line":784,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0","version":"21.0.1.1"}

I suspect that it might have to with this part of the log:

"Message":"The requested uri(/login) cannot be processed by the script '/nextcloud/index.php'

Meaning that Apache is redirecting traffic to /nextcloud/index.php even before it can send it to Grafana, but I'm not 100% sure.

Does anyone have an idea how to fix this?

elporsche
  • 43
  • 1
  • 5

0 Answers0