Please be sure to use:
pasv_address=YOUR_PUBLIC_IP
In the vsftpd configuration, where YOUR_PUBLIC_IP is the Public IP of your EC2 instance since otherwise you won't be able to login to vsftpd.
The rest can be used from the 1'st answer, or you can alternatively use php-fpm working with an user of your choice. For instance assuming you want to use user webuser, you'll need to take the next steps(all steps should be done as the root user):
1) Create the user and change the privileges:
useradd -d /usr/share/nginx/www webuser
chown webuser.webuser -R /usr/share/nginx/www
2) Don't forget to add a password for this user by typing:
passwd webuser
3) Configure your php-fpm install by making /etc/php-fpm.conf have the following:
include=/etc/php-fpm.d/*.conf
[global]
pid = /var/run/php-fpm/php-fpm.pid
error_log = /var/log/php-fpm/error.log
daemonize = yes
And also create a /etc/php-fpm.d/webuser.conf with the next contents:
[webuser]
listen = /var/run/webuser.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0600
user = webuser
group = webuser
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 10240
env[HOSTNAME] = $HOSTNAME
env[PATH] = /bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f hostmaster@yourservername
php_flag[display_errors] = off
php_admin_value[error_log] = /usr/share/nginx/logs/php-errors.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 512M
php_admin_value[session.save_path] = /tmp/
php_admin_value[date.timezone] = "UTC"
4) Add a vhost config to your nginx configuration like:
server {
listen *:80;
server_name yourservername.com www.yourservername.com;
client_max_body_size 24M;
root /usr/share/nginx/www;
location / {
index index.php index.html;
}
access_log /usr/share/nginx/logs/access.log;
error_log /usr/share/nginx/logs/error.log;
error_page 404 /;
location ~ /\.ht
{
deny all;
}
location ~ \.php$ {
index index.php index.html;
fastcgi_pass unix:/var/run/webuser.sock;
fastcgi_index index.php;
fastcgi_pass_header 'Set-Cookie';
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_param QUERY_STRING $uri;
include fastcgi_params;
break;
}
}
5) Restart your php-fpm service and restart your nginx service.
That should make it working.
Note: Make sure to create the /usr/share/nginx/logs directory.