Change the path for the web with FreePBX 14.0.13.4


#1

I have a server with some webs, so I do not want to have FreePBX installed in /var/www/html. I tried it first with a subdirectory in /var/www, e.g. /var/www/freepbx. This works in principle, but FreePBX sets the permissions (asterisk: asterisk) from /var/www downwards and not just from /var/www/freepbx, so all my webs have the wrong permissions. Furthermore, files or directories like .npm .pm2 etc. are created in /var/www instead in /var/www/freepbx.

So I tried to install FreePBX in a completely different place: /var/htdocs/freepbx. But that also results in the same problem. Although after installation under /var/htdocs/freepbx the subfolder admin contains all necessary subfolders and files, the permissions are not changed under /var/htdocs/freepbx, but under /var/www and the above mentioned files and folders still generated there.

I can not do more than give the path for the web in the installation routine. I assume the code will probably fix refer to /var/www.

How can I solve that?


FreePBX and PHP support
#2

Are you running the installer with the --webroot= option?


#3

When you ‘install’ freepbx , you can choose the user and group freepbx expects asterisk to be running as, in /etc/default/asterisk you can set the user and group that asterisk IS running as, if you make all the above www-data, you might have less of a conundrum. . .


#4

Yes I give --webroot=/var/htdocs/freepbx and --user=www-data with --no-interaction, because without the last one I am asked each parameter from the script.

The web is installed under /var/htdocs/freepbx, but the permissions are set recursively on /var/www with www-data:asterisk. If I don’t give --user=www-data the permissions are set recursively on /var/www with asterisk:asterisk. The permissions on /var/htdocs/freepbx are not changed.

It seems that the install routine does not considered my decision to put the web under /var/htdocs/freepbx.


#5

The interaction bit is very informative, I suggest you don’t bypass it.

you forgot the ‘–group=www-data’ bit , is asterisk running as the www-data user?


#6

Yes, asterisk is running with the www-data user. I have given the user www-data access to the group asterisk and vice versa, the user asterisk has access to the group www-data. This is not the problem.

I have detected the root cause: for the mentioned files FreePBX uses the home directory of the given user. The home directory for the user www-data is /var/www. That is the cause that all these files are there and the install routine sets the ownership of this directory.


#7

Today I have a new problem. I use install --webroot=/var/www/freepbx -n. The installer begins and stops shortly later because it cannot find a necessary php file. I see that on /var/www/freepbx there is a directory admin with a subdirectory modules which contains a few files. All other files are copied to /var/www/html/admin.
Is someone here that know how the intall routine works?