I need /var/www/config/config.json to be read by my app but not by users calling myapp.com/config/config.json. How would I do that?
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
||||
|
|
|
There are two main methods. One is to run your app as a different user from your web server, change the permissions on files so that they can only be read by the user running the app, and then proxy to it using your web server. You can use
If that's no good for you you could instead set up a rule like so to have your web server block them directly:
This can also be done with Apache using something like this in your
|
|||||||||
|
|
If you use SELinux, you can set the context to stop |
|||
|
|