How to run Nginx & php-fpm as ec2-user

WordPress files are places in /var/www/vhosts and this directory is owned by the nginx user, so you need to change the ownership or make the nginx user to change and upload files here.

How to SSH as nginx-user

In order for ec2-user user to upload files to /var/www/vhosts, please follow the steps below.

First, open the /opt/local/amimoto.json file and rewrite the contents like the following below:

{
"nginx" : { "config" : { "user" : "ec2-user" } },
"php" : { "config" : { "user" : "ec2-user" } },
"run_list" : [ "recipe[amimoto]" ]
}

For AMIMOTO HHVM, rewrite as follows:

{
"nginx" : { "config" : { "user" : "ec2-user" } },
"php" : { "config" : { "user" : "ec2-user" } },
"hhvm" : { "enabled" : true, "config" : { "user" : "nginx" } },
"run_list" : [ "recipe[amimoto]" ]
}

Then run /opt/local/provision with root privileges.

$ sudo /opt/local/provision

After that, change the owner of /var/www/vhosts for ec2-user to be able to play with the directory.

$ sudo chown -R ec2-user:nginx /var/www/vhosts