Im trying to enable a chroot with modsecurity 2.7.4 but I running into the problem that sometimes apache2 looks for config files inside the jail and sometime outside.

First I couldnt stop apache2 "sudo service apache2 stop" because it couldnt find the apache2.pid file. I solved this be creating a symbolic link from the location outside the jail where scripts expected the file to the location inside the jail where the file was actually created.

sudo ln -s /var/jail/var/run/apache2 /var/run/apache2

Next problem is that I cant reload apache2 gracefully. When I "sudo service apache2 reload" then apache2 fails to find its apache2.conf file. I tried solving it by linking from inside the jail to the config outside but apache2 thinks there are loops in my symbolic links this way and since apache2.conf includes lots of other files it doesnt seem viable.

Is there any way I can enable modsecurity without moving files from the original ubuntu packages? I cant mess up the packages because of constraints in our support agreement and because our hosting company patch software regularly using the official packages.