Updating Wordpress inside a container. No FTP access - wordpress

I installed a Wordpress website with the wordpress Docker image, and then installed my themes. All works well, but when I want to update Wordpress later on, I get this 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.
The Wordpress container is not running an FTP server on the web root. How could I solve this problem?
PS: I have my web root in a data container, shared among different containers.
PS2: I am planning on storing several Wordpress websites in the same host. Is there also a solution that is compatible with this?

The key is to make sure your web server is the owner of the directory WordPress is installed in (and its sub-directories). You're seeing an error because your web server doesn't have the proper privileges to write to your directories.
I recommend running a chown -R user:group /path/to/wordpress, substituting the user and group with your server's info.

Related

Restrict access to file manager plugin in WordPress LEMP stack

I had installed two WordPress sites on same server (Ubuntu + Nginx +Mariadb + php-fpm).
/var/www/html
/var/www/html2
Now problem is that file manager plugin installed on one WordPress site can read and edit files of another site.
Example: Plugin of WordPress at /var/www/html and edit files of /var/www/html2
Is there any way to restrict access of file manager plugin of one WordPress to installation_folder of that WordPress only?
The only way to do this is to run several php-fpm pools with different users specified in www.conf, one user per site. And lock users in their respective folders: /var/www/html, /var/www/html2, etc.
WordPress plugin has those access rights which php has. Php has those access rights, which user has, under which name it is executed.
It is a common problem, not related to any certain plugin. Now php code by itself has access to all sites, and if one site will become infected, then virus will copy itself to all sites on the server.
Finally solved the problem. As KAGG Design suggested, creating separate php process for each site fixed it.
In case anybody face same problem in future:- https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04

How to deploy a local wordpress to bluehost server using git

I have a wordpress website in localhost and a hosting plan with a domain name on Bluehost.com
My website is ready and now I wanted to go live and push my website to hosting server using Git. But in Bluehost C-panel there is no git option.
I have searched google but did not succeed to find a solution, so I came here if somebody could redirect to me to a tutorial link or give me some clues on how to do it i would be very grateful.
If you have VPS or Dedicated server on bluehost, try this manual from Bluehost FAQ:
https://my.bluehost.com/cgi/help/2383
Pretty sure, that you must manually import database (as it not included to git and can't upload automatically in mysql) and configure again wp-config.php. Also you don't say, what server you using with localhost, cause it can be different from bluehost config (for example apache / nginx / php version).

ERR_SSL_PROTOCOL_ERROR after migrating WordPress site to another site - attempting to create staging environment

I have a site hosted on 1&1 Ionos hosting. Purchased an SSL for the site from 1&1 Ionos as well. So let's say https://www.business.com/ is what I have. Then I have another another site say http://www.mycompany.com/ hosted at the same place - still waiting for my business SSL to be approved hence the http.
So I exported the database from business.com using plugin WP Migrated DB - setting the new URL and actual filepath.
Then I imported the database into a new database for my staging environment to be hosted at http://www.mycompany.com/clients/business.
I copied ALL the wordpress files for the site http://www.business.com/ into http://www.mycompany.com/clients/business exactly except I changed wp_config.php file to reflect the new database details. i.e username, database, location and password.
So I expected http://www.mycompany.com/clients/business to be a complete replica of the original https://www.business.com/. But when I browse to http://www.mycompany.com/clients/business I get the following error:
This site can’t provide a secure connection mycompany.com sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR
I can't even login to the admin panel of http://www.mycompany.com/clients/business/wp-admin
Is what I tried even possible and if it is please tell me what I did wrong and how to fix it. I'd like to create a staging environment to test new themes and plugins before implementing on live environment. Critical to my original site is the aMember plugin which manages all the membership registration info. I've deleted the Really Simple SSL plugin folder from WP-Content/Plugins folder but the error remains.
Thanks in advance for any and all help and advice!
Step 1:
Check your .htaccess for rules enforcing https
Step 2:
Did you replace all links in the database? If not, you must search and replace all links from https://www.business.com/ to http://www.mycompany.com/
You can use a tool from: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/comment-page-4/
Or just use command line wpcli (wp search-replace https://www.business.com http://www.mycompany.com
Step 3:
Open the new 'http://www.mycompany.com/' in a incognito tab. Browser caching might still redirect you to https.

Server ftp write errors

We have a linux based server through which we offer a hosting service. We have a problem with WordPress and other platforms. each wordpress site asks FTP accounts every time you install WordPress, themes, add ons or to try to upgrade it .
We need to get write access to the wordpress , joomla , drupal , etc. platforms automatically when its installed to customers server space via softaculus .
I have no experience of the hosting service, im just make websites, and I've tried to make the ftp accounts wp -config file, but it does not fix the other customer sites and when added to the wp -config file, it is not the best solution (Still asks for a password when install theme, add ons or update anything)
Sorry for bad english. can anyone help me to get this problem fixed?
We need write acces for: Joomla, Wordpress, Drupal, Magent ETC bases. We have c-panel acces for every customer and softaculus installer for wordpress etc platforms
When you get the error message, web server needs to get write access to the WordPress files. So you can add write access to the files, I think the problem will resolved.
If you couldn't add write access to the files, you would contact your hosting service center.
It's most likely the permissions problems here.
You need to be sure that your webserver can read all files and folders in the web root folder and you need to make every user the owner of each folder and files.
Using cPanel it should be done automatically when you create FTP user and providing it's home directory. If you have a mess with permissions already you may need to edit them manually. You can try to set 644 permission for all files and folders and then change owner to the actual user.
Look here for more information about file permissions on Linux, it should help.
Its been fixed, I set on apache write access different so its now working probably!
Link for details:
https://wordpress.org/support/topic/folder-permission-on-linux-ubuntu

Will Deploying Git via Beanstalk affect WordPress Upload Directory Permissions?

I've got a WP site in a workflow that goes local--> git (beanstalk) --> dev server.
Everything seems to be working fine when I deploy, but I've noticed that I can't upload images via WP and it seems like it's a directory permission issue.
The error I get is: "The uploaded file could not be moved to /path/blah/blah...
Is this because the FTP user doesn't 'own' these directories/files (because they weren't created via the WP site / FTP account of the dev server?
Please let me know if you've got any brilliant work-arounds or insights. I'm stumped.
Thanks in advance.
This is because Beanstalk uses ftp to upload your files, that means the owner becomes the FTP user. If Wordpress then wants to access those files, it is no owner so it can't delete/alter them. You can use chown apache <filename> on SSH if you want to make apache (wordpress) owner again. But now Beanstalk can't overwrite the files for the same reason.
The way to go is use a .gitignore file to ignore folders like uploads and cache. You don't need them locally for development, if you do, just grab them once with ftp.
I use this one myself with some additions. It may seem weird at first, but it rocks when it all works. :)

Resources