I deployed wordpress site on EC2 and connected it using RDS mysql. Everything works perfect on the first run and as long as EC2 and RDS are running. As soon as i stop the ec2 and rds and try to reboot it next morning or straight away, i can get to word press site but content is not layed out properly and images are missing too. I searched through internet and found closely related issues which recommend using of elastic ip, i also used elastic ip and assign that to EC2 but still content of WP is missing. Any suggestion
Wordpress is embedding your website URL, or IP address if you don’t have a stable DNS name, in its configuration file and database.
Any change of the IP addrsss or DNS name after the initial installation will cause the behavior you’re seeing.
This page doc has the steps to fix that. https://codex.wordpress.org/Changing_The_Site_URL
The below script directly changes the IP address in the Wordpress database. Be sure to change DB_NAME, DB_USER and DB_PASSWORD
#!/bin/bash
DB_HOSTNAME=`grep DB_HOST /var/www/html/wordpress/wp-config.php | cut -d ',' -f2 | awk -F "'" '{ print $2 }'`
WP_URL="http://`curl http://169.254.169.254/latest/meta-data/public-hostname/`/wordpress"
DB_USER=wordpress
DB_PWD=password
DB_NAME=wordpress
mysql -u $DB_USER --password=$DB_PWD -h $DB_HOSTNAME $DB_NAME -e "UPDATE wp_options SET option_value='$WP_URL' WHERE option_name='siteurl' OR option_name='home'"
You can run this script automatically at boot time to adjust the DB to the new IP address of the EC2 instance.
Note that the long term solution is different : I would recommend to use two EC2 instances for availability and a load balancer. The load balancer will have a stable DNS name (that you can alias with a CNAME record in your domain DNS). The Wordpress database would include that CNAME name only.
See this whitepaper for best practices to deploy Wordpress on AWS : https://aws.amazon.com/blogs/architecture/wordpress-best-practices-on-aws/
I also faced same issue, when i installed wordpress on aws ec2 instance, i have created some posts and pages, and after some time i have stopped ec2 instance. When started ec2 instance, wordpress site did not showing contents.
So the Solution was i found is that, wordpress require static IP address, so i have created new ec2, assigned Elastic IP address to the ec2 instance and created wordpress blog, it worked fine for me even restarting the ec2 multiple times.
Related
In kubernetes, I have a wordpress container and a wp-cli Job.
To create the WordPress tables in the database using the URL, title, and default admin user details, I am running this command in the wp-cli Job:
wp core install --url=http://localhost:8087 --title=title --admin_user=user --admin_password=pass --admin_email=someone#email.com --skip-email
The --url parameter prevents Minikube from serving the wordpress site.
You should put the ip address of your service there in place of "localhost".
When i say service, I'm talking about the service that exposes your deployment/pods (its another kubernetes object you got to create).
You can pass the IP address using an environment variable . When creating a service, the pods that are started inherit extra environment variables that kubernetes places in them, through which you can access the ip address, the port, both etc... check documentation.
The second option is to place there the name of your service (still talking about the kubernetes object you created to expose your deployment). It will be resolved to the IP address in fine by the DNS of the cluster (CoreDNS as of today is started along with minikube).
Those two options are in the documentation in the same section called discovering services.
I had trouble to understand that things like: service-name.name-space.svc.cluster.default are like any url (like subsubdomain.subdomain.stackoverflow.com) but being resolved within the cluster.
I'm still new to AWS and this is my first attempt at working with MariaDB; I'm used to dealing with hosting providers that already have something like cPanel installed so please be nice. :)
I'm using Bitnami's WordPress Multi-Tier with Amazon RDS for MariaDB
Bitnami's documentation is usually quite good, but in this particular case I'm not finding anything. I've reached out to their support and the only reply I've received until now was something akin to: "use a WordPress plugin to make database exports" which is obviously isn't going to cut the mustard when it comes to importing.
What I want to accomplish:
Connect to my database
Export my database
Import (overwrite) a database
Essentially, I want to deploy my local WordPress to AWS...files are all good, but I'm lost when it comes to databases.
(NOTE: I want to get out of the habit of relying on phpMyAdmin and, ideally, don't want to have to go through installing it, etc)
I started here: [Connecting to a DB Instance Running the MariaDB Database Engine][2]
After SSH'ing in I've tried:
Command: mysql
Outputs: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (2)
Command: mysql -h MY-DB-INSTANCE.us-east-1.rds.amazonaws.com -P 3306 -u bitnami
Outputs: Access denied for user 'bitnami'#'10.0.4.110' (using password: NO)
EDIT: I've split this thread into a separate one for other issues that I ran into.
Presumably your MySQL user bitnami actually has a password, so you may try this:
mysql -h MY-DB-INSTNACE.us-east-1.rds.amazonaws.com -P 3306 -u bitnami -p
^^^ add this
Your shell should prompt you for the password.
Beyond this, you need to make sure that you have opened your RDS instance to the IP from which you are trying to connect. You could open it to all IPs, but it is better practice to just open it to your dev machine, as well as the production machines which would be hitting the database. If you don't do this step, you also would not be able to connect.
Edit: If your user bitnami does not yet exist, then you may have to login as root and configure. Or perhaps you would have to reset the password if forgotten. You should always write down the admin credentials, as a last resort means of accessing your RDS instance.
I’ve set up a multisite Wordpress installation and would like to move it to 2 EC2 instances behind a load balancer. My issue is with the wp-config.php configuration setting for the DOMAIN_CURRENT_SITE parameter. I currently have it set as follows
define('DOMAIN_CURRENT_SITE', ‘ec2-instance-1.us-west-2.compute.amazonaws.com');
How should this be set if I am load balancing between multiple EC2 instances? Because it’s multisite the DOMAIN_CURRENT_SITE value is saved in the WP database. I am unsure how this should be set since I am sharing a single RDS db between multiple Wordpress instances. If I set it to one of the EC2 host names then the others would generate an error when connecting to the db. I’ve tried setting it to the load balancer domain name (and have updated the domain name in the db) but I’m getting a blank white page and the load balancer shows the EC2 instances as ‘Out of Service’. I’d appreciate any help anyone can offer.
Thanks
Make a DNS CNAME record for the ELB's hostname. Then use the CNAME's hostname as the DOMAIN_CURRENT_SITE.
Just an update - it turned out the issue was caused by not including the correct IP addresses in the security group for the EC2 instances and the load balancer. Once I added the addresses to each security group the ELB was able to direct traffic to the instances without a problem.
woocommerce webhooks aren't firing at all for me, even on a fresh install. I did the following:
Create a new MySQL database
Install WP from the zip file.
Set up WP.
Install Woocommerce.
Enable REST API and create a key.
Added "Coupon created" webhook, made sure it's set to active, and set it to a publicly accessible site.
When I create a coupon, the webhook does not fire, and no entry is created in the log. I tried this with orders as well and also doesn't work.
I think it's a machine configuration problem, but not sure what to change. The machine is an EC2 instance and has all ports opened in its security group policy.
Weirdest of all is that on a different EC2 instance does work, but it's a production machine and I want to have a dev server work so I can test out things. The only config differences between the production and dev machines that I can think of are the subnets and the firewall, but I don't understand why the subnet should matter and I opened all the firewall ports on the dev machine.
what Linux distributions are you running for prod and dev?
CentOS with SELinux enabled with not allow HTTPD scripts and modules to connect to network by default.
setsebool -P httpd_can_network_connect on
If above is not valid, please identify network problems by trying connecting to AWS RDS via SSH CLI. If you can open a connection via SSH CLI, the problem will be with your application. If you can't, it will be network problem. First thing to check in that case is AWS RDS security group. For testing you can open 3306 to public.
Let me know how it goes.
I created an instance to host my wordpress blog. I made a keypair, converted it using PuTTY Gen so that it would work with winscp.
My security group that is associated with my instance has:
ICMP Allow All
TCP 0-65535
TCP 22 (SSH)
TCP 80 (HTTP)
TCP 443 (HTTPS)
UDP 0-65535
I am running a Bitnami-Wordpress 3.2.1-0 Ubuntu AMI
My Question is: How do I host a simple file on my instance?
UPDATE: so I was able to login using SFTP by simply filling in my instance Public DNS as my host, and the PuTTY Gen key as the private key, the username I had to use was Bitnami. So now I have access to the server, how or where do I put a file so that it will come out www.mywebsite.com/myfile.file???
I am assuming that I need to SSH into the server using putty, and add it into the WWW directoroy?
What I have tried:
I tried logging in using WinSCP with host name being my instance's Public DNS, and my private key file the converted PuTTY Gen file that was originally the key pair for the instance.
Using SFTP, pressing login it asks me for a user name, entering "user" or "ec2-user" I get an error saying:
"disconnected, no supported authentication methods available (server sent: public key), Server >refused our key. Authentication failed.
Using root for the username, it asks for a passphrase that I created for my keypair using PuTTY Gen, It accepts it, but then I get this error:
"Received too large (1349281121 B) SFTP packet. Max supported packet size is 1024000 B. The error >is typically caused by message printed from startup script (like .profile). The message may start >with ""Plea"". Cannot initialize SFTP protocol. Is the host running a SFTP server?
If in WinSCP I put the username as "user" and the password as "bitnami" (before I press login) (default wordpress password for bitnami AMI) it gives me this error:
Disconnected: No supported authentication methods available (server sent: publickey). Authentication log (see session log for details):Using username: "user". Server refused ourkey. Authentication failed.
I get the same errors using SCP instead of SFTP in WinSCP except when I use SCP and I press login, and I use username "root" it asks me for my passphrase, after entering that I get this error:
Connection has been unexpectedly closed. Server sent command exit status 0. Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).
Also, if you want to remove wordpress from the URL, you can use the following instructions I posted on my blog (travisnelson.net):
$ sudo chmod 777 /opt/bitnami/apache2/conf/httpd.conf
$ vi /opt/bitnami/apache2/conf/httpd.conf
changed DocumentRoot to be: DocumentRoot “/opt/bitnami/apps/wordpress/htdocs”
$ sudo chmod 544 /opt/bitnami/apache2/conf/httpd.conf
$ sudo apachectl -k restart
Then in WordPress, change the Site address (URL) in General Settings to not have /wordpress.
Hope this helps
If you are already able to connect using SFTP. Now you just need to copy the file. Where you need to copy it depend on what you are trying to do.
BitNami Wordpress AMI has the following directory structure (I only include the relevant directories for this question):
/opt/bitnami
|
|-- apache2/htdocs
|-- apps/wordpress/htdocs
You mentioned that you want to www.mywebsite.com/myfile.file. If you didn't modify the default apache configuration you will need to copy file in /opt/bitnami/apache2/htdocs (this is the DocumentRoot for the BitNami WordPress AMI.
If you want that file to be accessed from www.mywebsite.com/wordpress/myfile.file, then you need to copy it in /opt/bitnami/apps/wordpress/htdocs.
If what you are trying to do is to manually install a theme or plugin you can follow the WordPress documentation taking into account that the wordpress installation directory is /opt/bitnami/apps/wordpress/htdocs.
Also, you can find below some links to the BitNami Wiki explaining how to connect to the AMIs. I just include them as a reference for other users that find the same connection issues.
Further reading:
How to connect to your amazon instance
How to upload files from Windows
I had a similar problem recently. Having setup Bitnami Wordpress on AmazonAWS I was unable to modify, add, or remove themes from within the Wordpress admin interface even though all of my permissions were setup appropriately according to Wordpress recommended settings. However, I did not want to have to resort to turning FTP access on.
I was able to resolve the issue by:
Setting the file access method for Bitnami Wordpress to 'direct'.
Changing all users to Apache Bitnami.
Adding Bitnami to Apache group and Apache to Bitnami group.