Reverse proxy documentation for Apache

So I read: The Reverse Proxy Documentation

And although I followed what it says there I had a hard time getting reverse proxy to work. Basically because I missed a ‘/’ in the Apache configuration.

The situation at hand:

Apache config:

<VirtualHost *:443>
        DocumentRoot /var/www/virtual/
        ErrorLog /var/www/virtual/
        CustomLog /var/www/virtual/ combined
        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/
        SSLCertificateKeyFile /etc/letsencrypt/live/
        SSLCertificateChainFile /etc/letsencrypt/live/
        # No weak export crypto allowed
        SSLHonorCipherOrder on
        SSLProtocol all -SSLv2 -SSLv3 -TLSv1
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
#Starts here
        ReWriteEngine on
        ProxyPass "/"  ""
        ProxyPassReverse "/"  ""
#Ends here

My grafana.conf :

# The public facing domain name used to access grafana from a browser
domain =

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
;enforce_domain = false

# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
root_url = https://%(domain)s/

Of course it would have been better to use Nginx or HAProxy but my server is already running Apache, so I wanted to use that. Maybe others can benefit from this too.


Hello! Thanks for this post!
Where do I find the grafana.conf file on Ubuntu 18.04 using Apache2?

You don’t “find” it anywhere - you create it yourself and put it under
/etc/apache2/sites-available and then enable the site using a2ensite.


1 Like

Thanks Antony!

I created file /etc/apache2/sites-available/grafana.conf and changed only the line ‘domain’ with my domain.

run a2ensite grafana.conf

and when I am going to restart apache2, I’ve got:
“Invalid command ‘domain’, perhaps misspelled or defined by a module not included in the server configuration”

I apologise. I mis-read ddt3’s recommendation - what s/he has called the
“Apache config” goes into the directory I mentioned, and I can only assume that
“grafana.conf” is actually “/etc/grafana/grafana.ini” - and note that only a
“snippet” was quoted - that is not the entire file :slight_smile:

I have no file called “grafana.cof” on my system.



1 Like

it worked, Thanks so much