I see this a lot in my server's apache logs (coming from different IPs and directed at different pathes). I am wondering if it can be an attack attempt, and in any case, how to deal with it?
The message "attempt to serve directory" means Apache received the request to server a directory (for example, "http: // www. yoursite. com / mydir"), which is a directory. Usually Apache would look for an index file (as defined with the DirectoryIndex directive, per-server, vhost or directory) or it would try to build a dir listing with the content of the directory.
So, that message could mean an attempt to access a part of your site without a DirectoryIndex (usually index.html or index.php in case of servers with PHP) or without the mod_dir module loaded, AND the mod_autodindex module disabled.
If you have lots of directories without index files and you don't want to enable directory browsing (autoindex), you will get lots of those messages. Even if you set the DirectoryIndex directive, if the defined index file does not exist, then Apache will again try the directory name and cause that log message.
The only way I can imagine if you want really get rid of those messages is to enable autoindex and then adding a IndexIgnore directive to ignore all files, rendering then empty directory listings:
However, if you have disabled directory browsing in you Apache as a security measure, please note any future vulnerability in mod_autoindex may allow an attacker to access the directory listing (something I don't really think is a vulnerability, but only you can decide that).
If the number of directories accessed this way is small, then a way to get rid of the message is to add a dummy index file (for example, an empty index.html file) in each directory (and setting DirectoryIndex to index.html).
FWIW - I just got this error and it related to the dir_module not being enabled and so it did not pickup my DirectoryIndex directive.