drwxrwxr-x root root mean that only the
root user and members of the
root group can write to that directory. Creating or deleting files within a directory is considered to be writing to that directory so the permissions checks are done against the containing directory when you try to create the file
The other half of this problem is that it is Apache that is doing the creating of files. Apache usually runs as the
www-data user on Debian based systems and as
httpd on RedHat based systems. These users are not in the
root group and so cannot write to that directory.
The principle of least privilege suggests that we should make a change that allows just what we want and no more. So I think changing the directory owner to the Apache user would do the job.
chown www-data /var/www/awstats
You can also change the mode back to
775 if you want and it will still work.
Instead of changing the ownership, you could change the group of the directory, or add the
www-data user to the
root group, or change the mode of the directory to 777. The latter two allow much more than just what we're trying to do here and hence should be considered dangerous.