When you get the error ” Unable to create directory wp-content/uploads/2021/12 ” when you are uploading media in WordPress something is wrong with the folder permissions. Another well known error is “The uploaded file could not be moved to wp-content/uploads/2021/12.”
In my case both SELinux and permissions on the uploads folder appeared to be the problem.
Fix the folder permissions by making user apache owner.
cd <to the wp-content folder>
chown -R apache uploads/
In /var/log/audit/audit.log you can see that SELinux is denying write access.
Fix the SELinux folder permissions by giving it write access to the uploads folder.
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/wp-content/uploads(/.*)?"
restorecon -Rv /var/www/html/wp-content/uploads