Koozali.org: home of the SME Server
Contribs.org Forums => General Discussion => Topic started by: guest22 on January 24, 2017, 02:22:25 PM
-
Hi,
what is the (correct) way, if possible, to set the document root to /opt/myapp ? The /opt/myapp sees the Primary ibay as document root. Can I used a php_admin_flag or a custom fragment in httpd.conf?
TIA
-
I think it is a hack to httpd.conf
I guess the clues are in this section https://wiki.contribs.org/Useful_Commands#Apache_Related_Commands
You probably need a custom fragment based on that. Add one of those commands to an ibay, update and then check the httpd.conf and VirtualHost sections.
A quick grep of /etc/httpd/conf like this shows some Pydio settings
grep -rn base /etc/httpd/conf/*
php_admin_value open_basedir /usr/share/pydio:/var/lib/pydio:/var/log/pydio:/etc/pydio:/var/cache/pydio:/usr/share/pear/:/home/e-smith/files/shares
B. Rgds
JC
-
Thanks, but that's about setting php open basedir as per wiki (useful commands). I'm looking very specifically how to set the document root.
-
Thanks, but that's about setting php open basedir as per wiki (useful commands). I'm looking very specifically how to set the document root.
It's in httpd.conf
Note I never knew how to do this and found out by having a grep about for DocumentRoot and looking at the code in some contribs
[root@esmith conf]# grep Document httpd.conf
# Documentation for modules is in "/home/httpd/manual/mod" in HTML format.
# DocumentRoot: The directory out of which you will serve your
DocumentRoot /home/e-smith/files/ibays/Primary/html
DocumentRoot /home/e-smith/files/ibays/crm/html
Set via the httpd.conf templates e.g.
cd /etc/e-smith/templates/etc/httpd/conf/httpd.conf
[root@home httpd.conf]# grep -rn Document *
15DSOstart:14:# Documentation for modules is in "/home/httpd/manual/mod" in HTML format.
50DocRoot:1:# DocumentRoot: The directory out of which you will serve your
50DocRoot:5:DocumentRoot /home/e-smith/files/ibays/Primary/html
VirtualHosts/20IbayContent:15: $OUT .= " DocumentRoot $basedir/html\n";
WebAppVirtualHost/50Content:55: my $root = $domain->prop('DocumentRoot') ||
WebAppVirtualHost/50Content:58: $OUT .= " DocumentRoot $root\n";
Unfortunately it will only point to one of your existing ibays (check $basedir in templates, VirtualHosts/20IbayContent), so if you want to use /opt you need a bit of trickery.
Make your own virtualhost templates (copy over another example) to a new directory. If you used the stock one as a template then you can modify $basedir depending on what you want as a trigger for it.
A good one to use as a base would be the WebAppVirtualHost from Dans contrib - see the template 50Content to see how the DocumentRoot is set.
/etc/e-smith/templates/etc/httpd/conf/httpd.conf/WebAppVirtualHost -> VirtualhostTest
Modify templates to give you the config required.
You then need to tell a domain to use that template path to create the required VirtualHost entry in httpd.conf (other config entries removed for clarity):
my.domain.net=domain
Description=my opt domain
TemplatePath=VirtualhostTest
Job done. The only aside is why make life difficult and use /opt ? i know it used to be considered better but as far as I understand it now there is no reason not to just use an ibay.
B. Rgds
John