I have deleted a php file 8 months ago. But it is still accessible with server ip address (Ex: 123.45.67.89/path/deleted_file.php) But not via a domain address (Ex: //www.mydomain.com/path/deleted_file.php) Why is that and how can I stop this?
This is AWS EC2 Ubuntu Apache2 server.
Try restarting Apache. If that works, it's probably due to Apache/PHP keeping the file open. This is a weird (?) way of how the filesystem works. The filename is just an identifier and when you remove a file, you generally only remove the identifier. However, if another process still has the file open (aka an open file descriptor pointing to that file), it will still be able to acces all of the content. (This is just a short and inaccurate explanation, google a bit to get the exact details.)
This mechanism allows you for instance to upgrade applications in place, as well. And also why some applications (like firefox) will then ask you to restart them.
I found the issue.
ip requests are landing to the /var/www/ and there are same file path. (that was been using before moving to the new site) ex: /var/www/path/deleted_file.php
So better to try locate the file from root first :~ locate deleted_file.php