I give my users, with individual domains the ability to upload different files to my site. All data is stored out of the public folder in one directory on the server. Because of permission and architecture reasons, I cannot store it in the public folder!
I have one controller that handles all files (permissions eg.) for different domains via send_data, which is unfortunately very slow :(. Are there any faster alternatives I can use?
Here is my architecture:
One Project
domain1.com/assets -> points to files controller = gives the data from: /var/assets/domain1/
otherprojectdomain1.com/assets -> points to files controller = gives the data from: /var/assets/domain1/
Other Project
domain2.com/assets -> points to files controller = gives the data from: /var/assets/domain2/
If you are trying to serve actual files from a server your probably better off using send_file rather than send_data. You can also tweak apache or nginx settings with the send_file option.
here is a link which shows an example of a controller using send_file:
protecting-your-paperclip-downloads
Hope this helps.