Search code examples
nginxfreebsd.htpasswd

Nginx password on FreeNAS (FreeBSD) htpasswd


I have nginx running on FreeNAS in a jail in front of various plugins like transmission, couchpotato, etc. As far as I know FreeNAS is based on FreeBSD.

I'd like to expose this server to the outside world, but can't work out how to set a password on nginx, as I can't get htpasswd installed on FreeNAS. I tried 'pkg install apache2-utils' but that doesn't work. Seen other solutions with python but that doesn't work either.

Bonus question: I'd like the password to only be asked for if coming from the outside world, ie not the local network. Is this at all possible?

here is my server definition:

server {
    location ^~ /sabnzbd {
            proxy_pass http://127.0.0.1:8080;
    }

    location ^~ /transmission {
            proxy_pass http://127.0.0.1:9091;
    }

    location ^~ /sickrage {
            proxy_pass http://127.0.0.1:8081;
    }

    location ^~ /couchpotato {
            proxy_pass http://127.0.0.1:5050;
    }
}

Solution

  • I guess, the package you are looking for is called p5-Apache-Htpasswd.