Test/Solution: grocy 2.6.1 and subdirectory installation on Apache
See original GitHub issueI’ve finally made some own test. It works, like this:
References #623, #619 and #661.
Debian 10.3 / Apache 2.4.38 / PHP 7.3
Base install
apt install apache2 php7.3 php7.3-sqlite3 unzip
a2enmod rewrite
cd /var/www/html
wget https://releases.grocy.info/v?2.6.1 -O grocy.zip
unzip grocy.zip -d grocy
chown -R www-data:www-data ./grocy/data
=> Webserver document root = /var/www/html
=> grocy directory = /var/www/html/grocy
Without URL rewriting
Changed config.php
settings:
Setting('BASE_PATH', '/grocy/public/index.php');
Setting('BASE_URL', 'http://<HOST>/grocy/public');
Setting('DISABLE_URL_REWRITING', true);
(Nothing else was changed in the default webserver/PHP config files.)
=> http://<HOST>/grocy/public/index.php/
is working (note the trailing slash for the root/main route)
With URL rewriting
Changed config.php
settings
Setting('BASE_PATH', '/grocy/public');
Setting('BASE_URL', 'http://<HOST>/grocy/public');
To allow .htaccess
overrides, this was added to /etc/apache2/apache2.conf
:
<Directory /var/www/html/grocy>
AllowOverride All
</Directory>
=> http://<HOST>/grocy/public/
is working (note the trailing slash for the root/main route)
Additional notes
Add a .htaccess
file in /var/www/html/grocy/data
with the following content to disallow direct access to the data dirctory (e. g. that someone can download the grocy database file)
Deny from all
Conclusion
Basically, BASE_PATH
needs to be set to the part (of the URL) after the document root, if URL rewriting is disabled, including index.php
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (11 by maintainers)
Top GitHub Comments
Not quite, I need to see what to adapt for nginx here. My first quick try was not successful. I edit this later when I find out something.
@dragoscazaceanu1313 please use the subbredit for custom setup questions, thanks.