Wordpress Plugin Installation - Failed to connect to FTP Server - Safest Solution?

人走茶凉 提交于 2020-11-30 05:26:27

问题


I succesfully set up a VPS LEMP-stack with Wordpress. When I am trying to install plugins from the WP backend, I am prompted with the following message:

To perform the requested action, WordPress needs to access your web server. 
Please enter your FTP credentials to proceed. If you do not remember your 
credentials, you should contact your web host.

When I enter my SFTP-account details, which I am using to access the server with FileZilla, I get the following error message:

Failed to connect to FTP Server 192.XXX.XXX.X:21

I read various tutorials, which suggest to install a FTP server, in particular vsftpd and then to store your FTP-User-details in the wp-config.php to avoid further authentication requestst. The problem I see is that, FTP is considered as severly unsecure and I would like to avoid hard-coding my user details into my WP-installation.

What is the safest, recommended way to deal with this problem?


回答1:


I don't know if it is the safest method or not. But pasting this code in wp-config.php once solved my problem:

define('FS_METHOD', 'direct');



回答2:


sudo chown -R www-data:www-data wp_site_root
sudo chmod -R g+rw wp_site_root

solved my problem.




回答3:


Remember to set files and directories permission in this way:

chown -R www-data:www-data /var/www
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;



回答4:


@MrNerdy,

I should have also elaborated on the fact that there should be some other folders you'll want to give permissions to. Read the documentation on it here to understand exactly what you should do regarding security: http://codex.wordpress.org/Changing_File_Permissions

Also, be careful to only install trusted plugins. I've seen dozens of sites hacked because of badly coded plugins / themes, etc. Good luck.




回答5:


For me it was bitnami related settings issue. This post helped me. There could be multiple reason:

  • Permission issue on the files and folders.
  • The FS_METHOD should be "direct" in wp-config.php file.
  • Remove FTP configuration from wp-config.php if you are migrating from bitnami to manage it on your own.



回答6:


If anyone is running into this issue using MAMP Pro.

Make sure you're running the server as the user that has permission for the root wordpress directory.

Under SETTINGS > Ports look for "Run server as" and in the drop down choose the same system user that has permission to access the root wp folder.




回答7:


if your'e using shared hosting then remove some files in your server and try again. it will work. its because your disk quota may be exceeded.



来源:https://stackoverflow.com/questions/21316282/wordpress-plugin-installation-failed-to-connect-to-ftp-server-safest-solutio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!