The owner of the document root folder/var/www/vhosts is which the runner is nginx the web server; you cannot upload files or folders to there directly through SFTP client or SSH.

This document describes how to change the owner of Nginx, PHP-FPM or HHVM to ec2-user.

Run HTTPD as ec2-user script

Firstly, access your server (instance) through SSH

$ ssh -i path/to/your/keyfile/xxxx.pem ec2-user@{IP-address-of-your-server}

Secondly, run the following command.

$ curl -L https://raw.githubusercontent.com/amimoto-ami/run-httpd-as-ec2-user/master/run-httpd-as-ec2-user.sh | sudo bash

note: copy and paste without $  mark.

That's all.
The owner of Nginx, PHP-FPM or HHVM has changed to ec2-user and runs as ec2-user.

Note: Run this script only once when you create the new instance.

Did this answer your question?