Dealing with SELinux and HTTP

Something I occasionally run into is 403 Forbidden errors on a website that should be totally accessible. After making sure it's not any of the typical issues like file permissions or an incorrect owner, it's usually SELinux that's the culprit. Even after years of administering Linux systems, I still don't have a great handle on how SELinux works, but I have come across a few useful commands that tend to help me move forward.

chcon -R -t httpd_sys_content_t /PATH/TO/ROOT/DIR
chcon -R -t httpd_sys_rw_content_t /PATH/TO/ROOT/DIR

These two commands will allow your web server to actually serve the files that you're hosting. The second one is only necessary if your server is doing any sort of read/write operations on its working directory.