Hello. I followed the instructions in the nixos manual on how to configure grocy and I have it up and running fine but, after much searching, I cannot find and information about how to change the port to something other than 80. Help would be appreciated, thanks.
looks like the module uses nginx for it’s webserver…so i presume your either accessing it tcp:80 or tcp:443
so you need to configure nginx to a different port, but that will move everything , all you virtual hosts etc etc etc.
I guess the answer is to spawn another nginx server just for the service, but currently nixos can’t do that by default.
Hopefully in the future nixos will be able to deploy ‘instances’ of each service.
You can probably pick another port for that virtual host: https://search.nixos.org/options?channel=21.05&from=0&size=50&sort=relevance&query=services.nginx.virtualHosts.<name>.listen
With apache httpd
I often serve different virtual hosts from specific ip addresses. Give it a try and let us know how it works.
I am guessing the virtual host name would be the host name I set with services.grocy.hostName?
Looks like it.
Something like services.nginx.virtualHosts."host.name.you.used".listen = [ { ports you } { want here } ];
hmm, i didn’t know you could get nginx to do that, and have a per virtualHost on different ports! thanks @aanderse
That worked perfectly, though I had to add the addr as well. Thanks!
services.nginx.virtualHosts.“grocy.tld”.listen = [ { addr = “192.168.1.114”; port = 2525; } ];
if your ip address changes, this would probably stop working, binding to ‘all interfaces’, 0.0.0.0 might be better (if you don’t mind that).
depends if nginx understands you want to bind to all interfaces.
I tried this method but after that the domain stopped working. Meaning if I tried “grocy.tld” it opens another service (why??) and if i do “192.168.1.114:2525” (in my case it would by my IP) it redirects to “192.168.1.114” (I supposed with port 80 or 443) and opens another services.
You must configure the virtualHost of the same hostname as set in config.services.grocy.hostName
, not literlally grocy.tld
. Something like services.nginx.virtualHosts.${config.services.grocy.hostName}.listen
should do it (untested).
I know, I was just using the example but I used my hostname for that.