Apache reverse proxy to piaware


#1

So, didn’t see any instructions no how to do this so figured I’d contribute.

Recently set up a Pi2 with piaware. Wanted to be able to give a link to friends to be able to view it’s interface. Saw multiple posts and sites claim to have info to do it. But they didn’t work.

If you have a website that is hosted at your house with Apache, perhaps www.example.com, and you want to access your piaware page. Add this to your site config:

RewriteEngine on
RewriteRule ^/adsb$ /adsb/ [R]
ProxyPassReverse /adsb ](http://):8080
ProxyPass /adsb ](http://):8080
ProxyPassReverse /dump1090 ](http://):8080/dump1090
ProxyPass /dump1090 ](http://):8080/dump1090

And go to www.example.com/adsb

Whalla!


#2

Forgot to mention - that could be a bit of a security risk. Might want to enable some security controls.


#3

Why not just have Apache serve the files normally?


#4

This is what I have. I have a soft link (why the commented out line for /data). The latest dump-mut moved /db, so that’s no longer needed.


$ cat /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /usr/share/dump1090-mutability/html
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /usr/share/dump1090-mutability/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                DirectoryIndex gmap.html
        </Directory>
#   Alias /data /run/dump1090-mutability
#   Alias /db /var/cache/dump1090-mutability/db

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>



#5

This is what I’ve been using for a while… with dump1090-mutability and lighttpd on the PiAware box. This lets you link to the Pi running PiAware using your.site.com/adsb If you don’t want that, then omit the ProxyPass for /adsb/ below and use the normal dump1090 URL instead. So then, this sends anything with /adsb/ or /dump1090/ over to lighttpd port 80 on the PiAware box. Note the trailing /'s. Of course you need to subsitute the IP address of your PiAware for 192.168.1.nn.

ProxyRequests Off
<Proxy * >
Order deny,allow
Allow from all

ProxyPass /adsb/ 192.168.1.nn/dump1090/
ProxyPass /dump1090/ 192.168.1.nn/dump1090/
ProxyPassReverse /dump1090/ 192.168.1.nn/