How to change port for grocy

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: NixOS Search - Loading...

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."".listen = [ { ports you } { want here } ];

1 Like

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 = “”; port = 2525; } ];


if your ip address changes, this would probably stop working, binding to ‘all interfaces’, might be better (if you don’t mind that).

depends if nginx understands you want to bind to all interfaces.

1 Like