How to configure grav flat-file CMS to work with LAMP?

Fast, Simple, Powerful... Grav is a modern flat-file CMS system that focuses on making web development fun again. It received the CMS Critic Award for Best Flat File CMS
several years consecutively. They say that there is Zero installation required. Just extract the ZIP archive, and you are already up and running. Up and running? Well...

I installed grav-admin from AUR and a directory named grav-admin was created in /usr/share/webapps/, not in the /srv/http/ folder. I searched the web for a solution and according to the instructions found on Reddit I opened the /etc/httpd/conf/httpd.conf file and changed both DocumentRoot "/opt/lampp/htdocs" and <Directory "/opt/lampp/htdocs"> accordingly, so they point to "/usr/share/webapps/".

Now when I open localhost or 127.0.1.1 or 127.0.0.1/grav-admin the browser detects the installation as it correctly redirects to 127.0.1.1/grav-admin/admin subfolder, but instead of the Grav Admin panel I get a 404 not found error.

I checked their Troubleshooting guide, but the things that I know what they mean are there:
.htaccess file is not missing, LoadModule rewrite_module modules/mod_rewrite.so is uncommented, their .htaccess Test Script runs fine and
mv .htaccess .htaccess-backup moves the file if I add sudo in front of it (I don't know if this is considered as test passed or not).

The other solutions don't seem relevant to me as my LAMP setup works fine otherways: test index.html and test.php load fine, Adminer also, and even my YII framework project works as expected. So I suspect there is something wrong with how the grav-admin that is on AUR is configured or that it just doesn't play well with Manjaro?

Any help would be appreciated!

Well, just in case somebody will have similar problems, after much trial and error the solution was found here:
https://learn.getgrav.org/16/troubleshooting/page-not-found#allowoverride-all, where they say:

In order for the Grav-provided .htaccess to be able to set the rewrite rules required for routing to work properly, Apache needs to first read the file. When your <Directory> or <VirtualHost> directive is setup with AllowOverride None , the .htaccess file is completely ignored. The simplest solution is to change this to AllowOverride All.

What this translates to is - I had to edit the httpd.conf file by using the following command:

sudo nano /etc/httpd/conf/httpd.conf

And change the line #278 from:

AllowOverride None

to

AllowOverride All

But wach out when searcing the config file, there are two more instances of AllowOverride set to None, which are not the right ones to change, so change just the one that follows this commented lines:

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit

Hope somebody will find this useful :blush:

1 Like

Forum kindly sponsored by