Given that your WordPress files are located in /usr/share/nginx/html
, you’ll need to adjust the -d
parameter accordingly when creating the FTP user. Here are the updated steps for creating the FTP user and setting the correct home directory:
Step 3: Create an FTP User
- Create a user with a home directory in your WordPress installation directory:
sudo adduser ftpuser -d /usr/share/nginx/html
- Set a password for the user:
sudo passwd ftpuser
- Change the ownership of the WordPress directory to the new user:
sudo chown -R ftpuser:ftpuser /usr/share/nginx/html
The rest of the steps remain the same. Here is the full process, including the necessary modifications for your specific setup:
Full Setup Process
Step 1: Install vsftpd
sudo yum update
sudo yum install vsftpd
Step 2: Configure vsftpd
- Open the vsftpd configuration file:
sudo vim /etc/vsftpd/vsftpd.conf
- Modify the following settings to match your requirements:
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
listen_ipv6=NO
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
Notice you cannot enable both IPv4 and IPv6.
The error message - 500 OOPS: run two copies of vsftpd for IPv4 and IPv6 - indicates that vsftpd is configured to listen on both IPv4 and IPv6, but it is only capable of handling one protocol at a time. You need to configure vsftpd to listen only on IPv4 to resolve this issue.
- Save and close the file.
Step 3: Create an FTP User
- Create a user with a home directory in your WordPress installation directory:
sudo adduser ftpuser -d /usr/share/nginx/html
- Set a password for the user:
sudo passwd ftpuser
- Change the ownership of the WordPress directory to the new user:
sudo chown -R ftpuser:ftpuser /usr/share/nginx/html
Step 4: Restart vsftpd
sudo systemctl restart vsftpd
sudo systemctl enable vsftpd
Step 5: Open FTP Port in Firewall
- Open port 21 (FTP) in the firewall:
sudo firewall-cmd --zone=public --permanent --add-port=21/tcp
sudo firewall-cmd --zone=public --permanent --add-port=20/tcp
sudo firewall-cmd --zone=public --permanent --add-service=ftp
sudo firewall-cmd --reload
Step 6: Configure SELinux (if enabled)
- If SELinux is enabled, set the correct context for the FTP home directory:
sudo setsebool -P ftpd_full_access 1
sudo chcon -R -t public_content_rw_t /usr/share/nginx/html
Step 7: Configure WordPress to Use FTP
- Edit the
wp-config.php
file in your WordPress directory:
sudo vim /usr/share/nginx/html/wp-config.php
- Add the following lines to the file:
define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/usr/share/nginx/html/');
define('FTP_USER', 'ftpuser');
define('FTP_PASS', 'your_password');
define('FTP_HOST', 'localhost');
define('FTP_SSL', false);
- Save and close the file.
Step 8: Install the Plugin
Now, you should be able to install the “Site Kit by Google” plugin through the WordPress admin interface. WordPress will use the FTP credentials provided to automatically handle the file operations required to install the plugin.