Disable directory listing in OpenCPU

2019-08-18 12:08发布

问题:

I have been trying to disable directory listing in OpenCPU so our users cannot see the resulting directories and files in the http://server/ocpu/tmp/ directory.

I have followed Apache's Directory Listing Configuration and deleted every mention of Indexes in the conf files in /etc/apache2/ and included Options -Indexes in the sites-enabled/opencpu.conf file (in the Location tags) without success.

I also looked at the rApache documention without finding any pertinent entry.

Does anyone know any documentation or configuration to achieve this?

回答1:

The directory listing is done dynamically by R code so Apache configs won't help here.

If you run the OpenCPU cloud server under Ubuntu directory listing of /ocpu/tmp is disabled by default via the apparmor configurations. Try it:

https://cloud.opencpu.org/ocpu/tmp/

This only works if your platform supports AppArmor, so it doesn't work for CentOS or Docker. Therefore Ubuntu deployment is recommended for production.