Lamp Custom document root

NethServer Version: 8
Module: lamp

Hello. Is it possible to specify a non-standard directory for Apache? /var/www/html/htdocs, for example. I use Dolibarr for CRM.

Hi and welcome to NethServer Community.

It could be possible to use a .htaccess file, see GitHub - NethServer/ns8-lamp: configure a lamp module with phpmyadmin · GitHub

There’s also a Dolibarr app available, see ns8:applications:applications [NethServer & NethSecurity] and NS8-Dolibarr App

I’ve already set up .htaccess. However, I can’t completely remove /htdocs from the address bar; either takepos isn’t working or it’s not downloading files. I also saw the app, but I understand it’s not updated. I thought maybe there was a feature I didn’t know about. I even tried adding APACHE_DOCUMENT_ROOT=/var/www/html/htdocs to the configuration, but that didn’t help. We’ll use it as is.

Does it work when you change the documentroot? This is just for testing, the config isn’t persistent and will be lost after a container restart.

Edit the default site:

runagent -m lamp1 podman exec -ti apache2-app nano /etc/apache2/sites-available/000-default.conf

Change the DocumentRoot:

DocumentRoot /var/www/html/htdocs

Restart apache:

runagent -m lamp1 podman exec -ti apache2-app apache2ctl restart
2 Likes

It would be great to add this functionality to the app’s settings. I’m ready for any testing.)

1 Like

Let’s hail the Oracle @stephdl

2 Likes

Do not know if it is possible without breaking the container, you can bind mount the httpd.conf by editing the systemd service for now.

The post marked as a solution will not survive a restart of the container

2 Likes

Could you elaborate on how to do this? I’m still learning how to work with containers.

A bind mount wasn’t working (I guess due to permissions) so I added a volume.
The problem is that the configuration is dynamic so after adding the volume, for example enabling/disabling phpmyadmin from the cluster-admin UI doesn’t work anymore but the change survives a container restart.

Edit the systemd service file:

runagent -m lamp1 systemctl --user edit --full apache2-app

Add the following at line 34:

    --volume sites-available:/etc/apache2/sites-available:Z \

Restart the service/container:

runagent -m lamp1 systemctl --user restart apache2-app
1 Like

Perfect!!! Thank you very much!

1 Like