bastelhalde.de


Ben,

Setting up Redash using Apache and a subdomain

We are currently tryring out several data visualization systems so we came accross redash. Because we are running mulitple web services on this server (gitlab, nextcloud and this blog) we decided to use a subdomain for redash and configure our Apache server to act as a reverse proxy to keep everything seperated.

The provisioning script you should use to install redash on your Ubuntu machine does some things we don't want so the first thing was to download it to our server and change it a bit.

So the first step would be to download the script to your server:

wget https://raw.githubusercontent.com/getredash/redash/master/setup/ubuntu/bootstrap.sh

If you have a look at the script it will automatically install nginx, which we don't need since we want to use Apache. So in the function installsystempackages() remove the package nginx from the apt install command in line 42. We also don't want to configure our nginx server, so comment out the function call to setup_nginx() in line 110.
In the end my script looks like this.

After a chmod +x bootstrap.sh we can now start the installation process using sudo ./bootstrap.sh. This can take a while.

When the script is done the redash server should be listening to the local port 5000. You can check that using curl 127.0.0.1:5000.

Now is the time to configure the apache server. I will assume that you already registered a subdomain and got a certificate for it (for example using Let's Encyrpt). Now what you want to do is to add an entry for your subdomain in the Apache2 configuration for your site like this:

<VirtualHost *:443>
        SSLEngine on
        ServerName redash.bastelhalde.de

        SSLCertificateChainFile /path/to/your/fullchain.pem
        SSLCertificateKeyFile /path/to/your/privkey.pem
        SSLCertificateFile /path/to/your/cert.pem

        RequestHeader set X_FORWARDED_PROTO 'https'
        RequestHeader set X-Forwarded-Ssl on

        ProxyPass / http://127.0.0.1:5000/
        ProxyPassReverse / http://127.0.0.1:5000/

</VirtualHost>

This is the result.


Leave Comment: