For this situation unless using a hardware encryption module the raw keys have to be available to the machine. For the encryption to offer any real benefit the keys must be stored in a format which is harder to read than the underlying files.
This means either
- store the files on a separate machine to the application. If the application server security model is broken they still have access to everything but if the file server is accessed all they get is encrypted information.
- Store the keys in a way that they aren't readable to the application. This is usually done by having a process running as a more privileged user read the keys then pass them through to the application on start. This means the only way any attacker gaining access as the same user as the application (assuming no opportunity for privilege escalation) can get hold of the keys is to read them out of memory or a core dump of the application.