Categories
Energy

Airsonic on FreeNAS

With the popularity of streaming services, I have had a big interest in trying to mobilize my own curated music collection in a similar way. There are a lot of different platforms out there, but very few that are truly open source or work on the systems I need. Although I’m still less than convinced it’s the best option, I decided to go with Airsonic for the time being.

As with most of these projects, I started with a guide written by someone else. Before starting, I mounted some out-of-jail storage to /var/airsonic, which is where the installation will end up storing its configuration. Make sure that folder gets the appropriate permissions:

chown -R www:www var/airsonic

Setting this up beforehand gets you persistent storage without having to find and move the config files later.

Other differences from the guide:

  • I like mounting things to /mnt/ so I did that instead of mounting to /media/.
  • I changed rc.conf to run as www:www instead of root:wheel or media:media as the guide suggested.

I had to configure my reverse proxy to be able to access it. I used a proxy file based on my previous configurations combined with the Airsonic guide. The final file looks like this:

server {
        listen 443 ssl http2;

        server_name airsonic.example.com;
        access_log /var/log/nginx/airsonic.access.log;
        error_log /var/log/nginx/airsonic.error.log;

        include snippets/airsonic.example.com.cert.conf;
        include snippets/ssl-params.conf;

        index index.html;

        location / {
            try_files $uri $uri/ =404;
            return 302 $scheme://$host/airsonic;
        }

        # Airsonic
        location /airsonic {
            # Proxy main Airsonic traffic
            proxy_pass http://192.168.1.28:4040/airsonic;
            proxy_redirect http:// https://;
            proxy_set_header Host $http_host;

            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded_host $http_host;

            proxy_max_temp_file_size 0;
        }
}

It has been working through the web interface so far. There are also a number of apps can be used—essentially anything that uses the Subsonic API is compatible with this. That being said, I’m not entirely sold on any of the apps just yet: many of them haven’t seen any development updates in over a year.