Web Server Settings

Some config settings, nothing crazy but it took me a while to figure out.

Ubuntu 17.10
Artful Aardvark

Exposed Services:

Grafana: https://danielbeadle.net/stats

Virtual Radar Server (VRS): https://danielbeadle.net/radar

Grafana:

The important details of /etc/grafana/grafana.ini:

[server]
protocol = http
http_port = 3000
domain = danielbeadle.net
root_url = http://danielbeadle.net/stats

Apache:

/etc/apache2/sites-enabled/danielbeadle.net.conf:

TODO: This doesn’t properly redirect HTTP requests to HTTPS.

<VirtualHost [DOMAIN_NAME]:80>
    ServerName [DOMAIN_NAME]
    DocumentRoot [WEBSITE_PATH]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost [DOMAIN_NAME]:443>
    ServerName [DOMAIN_NAME]

    ServerAdmin [EMAIL]
    DocumentRoot [WEBSITE_PATH]

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /blog [BLOG_PATH]
    <Directory [BLOG_PATH]>
        Options MultiViews Indexes Includes FollowSymLinks ExecCGI
        AllowOverride All
        Require all granted
        allow from all
    </Directory>
    
    # Reverse Proxy to Grafana:
    ProxyPass /stats http://localhost:3000
    
    # Reverse Proxy to Virtual Radar Server
    ProxyPass /radar http://danielbeadle.net:8080/VirtualRadar

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

# Letsencrypt files for HTTPS:
SSLCertificateFile [path to fullchain.pem]
SSLCertificateKeyFile [path to privkey.pem]
Include [path to options-ssl-apache.conf]
</VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet