Wordpress Amazon EC2 Database Error - wordpress

So, I have Bitnami Wordpress set up through a m1.small EC2 instance. About every hour, the site suddenly has a problem connecting to the database. The only way I can get it to work is by rebooting the instance.
Has anyone encountered this problem before or possibly have ideas for a fix?
Many thanks!
(Also, if you need me to provide any extra info I'd be glad to do so)

Yes, we've had this problem before with the bitnami AMI / MySQL just this week. It's normally because the MySQL server daemon dies on the EC2 instance.
To solve, we set up the MySQL database on RDS and connected Wordpress to that instead. The database will perform better on RDS and you won't have to worry about the daemon dying. If RDS is not an option then you'll have to dig into the MySQL / wordpress logs to find out what's going wrong with MySQL.

Related

Made a mistake with mysql restore on the production site instead of the staging one. Can I use mysql general log to restore?

Made a mistake with mysql restore on the production site instead of the staging one. Can I use mysql general log to restore? It seems general log is all I have. I dont seem to have a binlog with MariaDB's Aria storage engine.
What should I do now? Anyone has any experience using general log to recover the database?

Do I need a VM instance for each WordPress instance on Google Cloud?

I've been playing with Google Cloud, trying to figure out the most cost-effective way to host multiple low-traffic WordPress websites.
With Bitnami, it seems to me that for every new WordPress instance, I'm having to provision a new virtual machine. I also tried Google click-to-deploy WordPress setup, and it forced me to provision a cluster with 3 VM's.
Each of the new VM's cost money, so I'm wondering if there's a way to do something similar to shared Linux hosting, where I could host multiple WordPress instances on a single Virtual Machine.
You can use the Bitnami Wordpress multisite stack, which allows multiple sites to run on one server.
In you don't want to use the Bitnami Multisite solution, you can also install multiple WordPress apps in the same server without installing multiple database or web servers. Bitnami provides modules to install on top of an installed stack (normally LAMP stack) and the WordPress module allows you set the name of the blog you want to create.
The module can be downloaded from here but you will need to run the following commands in the instance (these commands will download the current version)
wget https://bitnami.com/redirect/to/269995/bitnami-wordpress-4.9.8-0-module-linux-x64-installer.run
chmod a+x bitnami-wordpress-4.9.8-0-module-linux-x64-installer.run
sudo ./bitnami-wordpress-VERSION-module-linux-x64-installer.run --wordpress_instance_name NEW_BLOG_NAME
Once you have the module installed, you will be able to access it through http://localhost/NEW_BLOG_NAME.
More info in the Bitnami documentation
https://docs.bitnami.com/installer/apps/wordpress/configuration/install-several-wordpress-modules/
I found the following post which has explains how it might be done.
http://designhack.slashlab.net/en/how-to-setup-multiple-wordpress-without-multisite-ft-bitnami/
Make sure to back up important data before you start.
There is the chance to set up multiple websites using bitnami, but i recommend to kept separate every site to avoid database confusion, and to extend the functionalities of every website.
https://bitnami.com/stack/wordpress-multisite
Im using a single VM per domain to avoid confusion with DNS.

Can RDS (Mysql in my case) endpoint be connected with 2 instances in different availability zones?

What am I trying to achieve?
1.Trying to build a fault-tolerant WordPress website.
2.Tried installing the webserver on one AZ with Muti-AZ RDS deployment.It was quite successful.
Set up is as follows
AZ-1 Public subnet - Launched one ec-2 instance, Installed httpd, PHP, PHP-MySQL, WORDPRESS.
AZ-1 Private subnet - Launched a Multi-AZ RDS instance
Problem Encountered:
When I Wanted to expand to another availability zone for fault tolerance.
Launched another ec-2 instance in different availability zone [AZ-2] and installed httpd, PHP, PHP-MySQL, WORDPRESS
I DID NOT launch an another RDS.I wanted to connect to the RDS in [AZ-1]coz its already a Multi-AZ, So wanted to have the fault tolerance set up only for the Web server. I was able to install WordPress on AZ-2 public subnet, but I was unable to connect to the
RDS[MYSQL]endpoint in AZ-1.
Getting the error message.
"Already installed.You appear to have already installed WordPress. To reinstall please clear your old database tables first".
"Already installed.You appear to have already installed WordPress. To
reinstall please clear your old database tables first".
This means your second web server can successfully connect to the RDS instance. Instead of trying to "install" WordPress, just copy all your WordPress files from the first web server and you'll be fine.

Installing Wordpress on IIS 7 - invalid root password or failed to connect

I'm 100% sure the user/pass are correct.
Screenshot: MYSQL command Line
Screenshot: WebPlatform Message
i've tried all the suggested workaround but none avail
deleting mysql_pwd from registry (HKCU/Software/Microsoft/WebPlatformInstaller/mysql_pwd)
installing latest mysql connector (6.9.9)
the other suggested way is to delete the folder path for mysql on my drive which I dont want to as i have existing data from my current database (MYSQL 5.7)
Have you created a non-root user and tested with it? I would do that anyway for INFOSEC reasons. My two cents: get the site onto a Linux VM. https://roots.io/trellis

WordPress FTP settings for AWS EC2

I have WordPress installed on AWS with EC2. I can connect via SFTP using FileZilla but if I try to update a plugin from within WordPress it asks me for the FTP details and I get the following error message:
ERROR: There was an error connecting to the server, Please verify the settings are correct.
I've read a lot of threads on here and followed a lot of steps to try to rectify, including:
added 2 new inbound Custom TCP rules to the EC2 Security Group; one for port 21 and one for ports 0-65000
added the following to my wp-config.ini:
define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/var/www/');
define('FTP_CONTENT_DIR', '/var/www/wp-content/');
define('FTP_PLUGIN_DIR ', '/var/www/wp-content/plugins/');
define('FTP_USER', 'ubuntu');
define('FTP_PASS', 'my_password_obviously');
define('FTP_HOST', 'my.ip.obviously');
define('FTP_SSL', false);
still no luck. can anyone help?
Thanks
Sean
Since you are on ec2, you have full control of your instance. You can use direct setting for FS_METHOD as a means of updating the core and any plugins.
Although keep in mind that this can be somewhat insecure if you do not properly configure your instance (The webserver user should be isolated). You would also want to be sure that you can trust the plugins your are installing.
Amazon EC2 has some issues with FTP. See here for a solution to this common issue. However, this may not be your best solution. I go by the philosophy that the fewer ports I can open, the safer I am. Even if you are keeping it open only to your local IP, you are not completely safe from a DoS or some other malicious attack. Multiple checks are better than one, and fewer ports are better than more.
The issue is that FTP is that it was designed and implemented prior to any of today's security concerns. While you can make FTP more secure, and there are solutions on the web for this (like the one above), a better - and possibly MUCH easier - solution could be found in allowing FTPS over Port 22. Evidently, by installing and activating some packages you may be able to open Wordpress updates to a new option.
See here (not tested by me) for the FTPS solution which runs through Port 22 by binding to PHP through libssh2-php on Debian (or these steps on CentOS).

Resources