Running Grocy with Caddy

I am playing around with this web application Grocy ( and currently trying to get it to work with Caddy.

I have a clean install of Manjaro Linux running in a VM and I have run the following commands to setup everything so far:

sudo pacman -Syu --noconfirm yay wget unzip
yay -Syu --noconfirm caddy sqlite php php-fpm php-sqlite

sudo sed -i 's/;extension=pdo_sqlite/extension=pdo_sqlite/g' /etc/php/php.ini
sudo sed -i 's/;extension=sqlite3/extension=sqlite3/g' /etc/php/php.ini

sudo systemctl start php-fpm
sudo systemctl enable php-fpm
sudo systemctl status php-fpm

wget -O

sudo unzip -d /usr/share/grocy

sudo rm

sudo cp /usr/share/grocy/config-dist.php /usr/share/grocy/data/config.php

sudo chown http:http /usr/share/grocy/data -R

Below is my caddyfile so far:

:9283 {
        errors /var/log/caddy/grocy_error.log
        root /usr/share/grocy/public

        fastcgi / unix:/run/php-fpm/php-fpm.sock php {
                index index.php

        rewrite {
                r .*
                ext /
                to /index.php?{query}

This seem to work just fine with the default Grocy data/config.php file. Although any suggestion on how to improve it would be appreciated.

however, I would like to change the base url to /grocy so it will work with my existing reverse proxy. In the Grocy data/config.php file I have changed

Setting(‘BASE_URL’, ‘/’);


Setting(‘BASE_URL’, ‘/grocy’);

And restated caddy. This however did not work. Now when I go to http://ipaddress:9293/grocy I get
“Page Not Found”. Do I also have to make changes to the Caddyfile to make this work? Or there something else going on I am not understanding?

Thank you

When the web root is set to /usr/share/grocy/public, and Caddy receives a request for /grocy, Caddy will be looking in /usr/share/grocy/public/grocy. Have you tried moving the site files there?

The index index.php subdirective you have for fastcgi is redundant. You can remove it - the php preset sets this.

Also, your rewrite - remove the regex. It matches literally everything, and you’re not using it for any captures. All this does is spin up the regex matcher, needlessly wasting CPU cycles. ext / is doing all the work here.

Thank you

Got it working

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.