vendredi 2 octobre 2015

Will Changing the file ownership of /var/www affect existing websites

I have a site myexample.com hosted on aws using EC2 Ubuntu stack. I installed wordpress and pointed blog.myexample.com to it.

The blog works fine except wordpress cannot write to the wp-uploads folder. Error:

Unable to create directory wp-content/uploads Is its parent directory writable by the server?

I have changed the permissions on the folders (777, 775) but it made no difference. It seems to be an ownership problem. Amazon recommend doing this: http://ift.tt/JkulVk

Add the apache user to the www group.

[ec2-user wordpress]$ sudo usermod -a -G www apache

Change the file ownership of /var/www and its contents to the apache user.

[ec2-user wordpress]$ sudo chown -R apache /var/www

Change the group ownership of /var/www and its contents to the www group.

[ec2-user wordpress]$ sudo chgrp -R www /var/www

Change the directory permissions of /var/www and its subdirectories to add group write permissions and to set the group ID on future subdirectories.

[ec2-user wordpress]$ sudo chmod 2775 /var/www
[ec2-user wordpress]$ find /var/www -type d -exec sudo chmod 2775 {} +

Recursively change the file permissions of /var/www and its subdirectories to add group write permissions.

[ec2-user wordpress]$ find /var/www -type f -exec sudo chmod 0664 {} +

Is there a risk that I will affect the existing websites on this server? There are two.

Are there any risks to doing this?

I cannot afford to make a mistake and impact the existing sites. Thanks!




Aucun commentaire:

Enregistrer un commentaire