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.