files – how to prevent my test.md and composer.json from being access publicly?

I have a test.md file which contains some written texts and a composer.json
the problem is when i typed test.md along with the url of my site, it gets downloaded.
if i type composer.json appended to my url, it gets displayed. is there a way to prevent these two files from being downloaded or viewed by public ?