1 min read

How to install Grocy with Apache on Debian 10

This took me longer than I'd like to admit, but, to be honest, their documentation is not on point.

Grocy is a web-based self-hosted groceries & household management solution for your home.

I already have a few services running on my home server, sitting behind my faithful Apache, accessible from a custom domain.

I don't want it running as a subdomain. Every explanation I found assumes that.

TL:DR: If you want Grocy running behind an Apache proxy, on your own subdomain, set it up like this:

  • Get Grocy:
$ cd /tmp
$ wget https://releases.grocy.info/latest
$ sudo unzip latest -d /var/www/html/grocy/
  • Copy the Grocy configuration file and change it to your liking:
$ sudo cp /var/www/html/grocy/config-dist.php /var/www/html/grocy/data/config.php
  • The important settings here are:
Setting('BASE_PATH', '');
Setting('BASE_URL', '/');
Setting('DISABLE_URL_REWRITING', false);

And they should be setup just like that for what we are looking to accomplish.

  • Create a configuration file in Apache for Grocy:
$ sudo vim /etc/apache2/sites-available/grocy.home.your-domain.pt.conf
  • Adapt the following to your configuration. The relevant part here is the DocumentRoot, and the Directory. Don't forget to set the full path to the Grocy public folder:
<VirtualHost *:80>
    ServerName grocy.home.your-domain.pt
    ServerAdmin your-name@your-domain.pt
    DocumentRoot /var/www/html/grocy/public
    ErrorLog /var/log/apache2/grocy-error.log
    CustomLog /var/log/apache2/grocy-access.log combined

<Directory /var/www/html/grocy/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>
</VirtualHost>
  • Enable the site:
$ sudo a2ensite grocy.home.your-domain.pt
  • Reload Apache:
$ sudo systemctl reload apache2

And your instance if running on http://grocy.home.your-domain.pt!

I've made a few assumptions here (you have your own local domain, have Apache already setup with PHP, etc), but I hope is helpful to someone.

Maybe later I'll update this post with a more detailed explanation.