I'm having some issues with Wordpress on my droplet. The initial server setup went without a hitch thanks to your great documentation. Then i set out to install Wordpress, using the this guide: https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-centos-6--2. This went well for the most part too, except for the last bit where you set your permissiaons. I noticed when I was trying to install a theme from the dashboard I initially got an error saying Unable to create directory wp-content/uploads/, the alert pretty much tells you it's a permissions issue. So after a quick search i realized i need to give the uploads folder the correct permissions. At first I gave apache user ownership of the uploads and cache folder as so chown -R apache:apache /var/www/html/wp-content/uploads. This solved the "unable to create directory error i was getting, but now it prompts me for the ftp credentials. After a another quick search I found that if I give apache user ownership of the /var/www/html directory like so chown -R apache:apache /var/www/html/ it would install themes without prompting me for the ftp credentials. I could of course just enter my ftp credentials, but I would prefer it would work automatically as intended.
While i was searching for the solutions I came across a couple of different posts/guides suggesting not to give the apache user ownership of the /var/www/html directory saying it's a big security risk. It is equivalent of saying chmod 777. I'm also aware of the other method where you define a constant/function. I've seen so many suggestions that i'm just not sure which one is really the safe safe and right way to do it.
Obviously it's working for me now, but i'm a little confused because of all the conflicting info. I would like to know if there is a preferred way or "good" practice in setting these permissions. This is my 1st WP blog and I would like to start off on the right foot and i'm sure many other people would benefit from this as well. So if someone can please provide some clarification on the best approach it would be greatly appreciated.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart.
If you run into issues leave a comment, or add your own answer to help others.