Automatic configure wordpress IP on EC2 - wordpress

I have installed a LAMP server on an EC2 instance. Then I created an AMI so that I can easily spin up instances in the future.
Today I went back to spin up one such instance, and to my surprise the IP in the configuration is wrong. Basically when I first installed the LAMP server, Wordpress detected the IP and configured accordingly. Now on the instance that I launched today the IP is different, but the configuration for the previous IP is still there.
Now, I know how to change Wordpress IP. My question is: How can I make this step automatic when I launch an EC2 instance from an AMI?
Thanks

Instance Metadata will give you a lot of information about the current EC2 instace. You can use that + some hand-crafted shell scripts which will be triggered on boot to update configuration.
An alternative solution is to use some configuration management tool (Chef, Ansible ... ). To help you configure the application.

Related

Creation of AMI from operating wordpress site yield "connection refused" with elastic ip

I created an AWS server and installed wordpress with an elastic ip address and verified that the default website was up and running.
I wanted to make a backup image at that point so that I could use it as a beginning point for other websites. However, after getting the AMI running and attaching the elastic ip address to it, I got an "connection refused" error. I can both SSH and FTP into the server, but the wordpress site is offline. I then switched the elastic ip back to the original server and got the exact same issue.
I'm guessing that this is a "change of ip" type error(?) (although, when I've seen that before, the connection has never been outright refused... it usually allows at least access to the admin area of the website) but I thought by using an elastic ip address that I would avoid that. I'm also confused by the error in the first server, since the database still has that address.
Any ideas about how to troubleshoot something like that? Is there anything else that it could be?
Well.... I missed something vital.
Using an AMI works just fine with an elastic ip address. I had forgotten to make sure the webserver (httpd) and mysqld were running with :
service httpd restart
and
service mysqld restart
What made it click was reading that the main reason for this error is that there is listener to the incoming data.
Duh.

AWS launchpad on Bitnami

I launched Wordpress stack for AWS launchpad on Bitnami. The instance shows its state as running in the EC2 console. I tried logging in via SSH, it doesn't connect. Also, if I try its public IP in the browser, it shows that the site could not be reached. I'm stuck on it from last 2 hours. Any help?
It looks to me that you have a firewall issue when connecting to the instance. I advise you to check if that is the case. In addition, I would also try restarting the instance or launching a new one to double check it.

Setting up SSL on AWS EC2

I'm trying to set up SSL on my wordpress site.
I've an EC2 instance running wordpress on nginx and ubuntu. Database running on RDS.
I've launched an application load balancer with listeners on ports 80 and 443 and attached the SSL certificate which I got via ACM. I've set my targets to point to the EC2 instance I am using.
At this point the how-to guides and information stops. Apparently that's all there is to it and it should now all be working. However it's not. I'm getting connection refused errors when I add the https to my site's URL.
When I put my URL into https://www.sslchecker.com/sslchecker I'm told that no certificates are found.
So clearly I need to something more to get this working - can anyone point me to the next step?
Using the ELB and ACB is the way to go here. It sounds like you might be using the wrong type of ELB though. You mentioned application load balancer, you should use a classic load balancer. Also make sure your security groups are setup correctly to allow your ELB to talk to the EC2 instance.
You didn't mention Route53 but I assume you have the DNS entry setup to point at the ELB as well.
Share more and I will help more. Good luck.

woocommerce webhooks not firing

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.

Configuring BIND for Ubuntu Web Server

I am looking for some assistance configuring BIND to host a DNS server on my web server.
I recently acquired a dedicated server running Ubuntu 14.04 LTS and I already have Nginx, PHP-FPM, MariaDB installed and working perfectly. My knowledge of postfix & dovecot are slim, so I followed this guide: A Mailserver on Ubuntu 14.04: Postfix, Dovecot, MySQL. The good news is that I've got mail coming in and going out as expected, but have come across another issue, which is some ISP and providers are denying the mail since there is no PTR records used.
So, I'm assuming I need to install and configure BIND to set up DNS and to set up a PTR record so that my mail will reach its destinations. I've tried Google with some tutorials but none of them seem clear for my purpose.
Installing a control panel, or one of those all-in-one scripts is out of the question since I already have the web server configured. Another issue is that some of them don't work with Nginx or use a different configuration of PHP. Plus, I want to learn how to do this on my own.
You don't have to install bind. Who ever has reverse DNS authority for your IP block will typically create a reverse name for you. Just request a reverse pointer record with the mail domain name for your IP.

Resources