How to fix a cloned AMI with another domain SSL certificate on it for Wordpress on AWS? - wordpress

In 2018 I made a Wordpress site by using a Bitnami AMI for a AWS EC2. Fine developed a site and created another custom AMI of the finalized Wordpress site. This was for domain X.
Now in 2020 I wanted to duplicate that website by using this custom AMI for domain Y. I have created an EC2 based on that custom AMI and instance went online without problems.
The problem is now that I can not reach the site by its url, I got blocked by "This connection is invalid", I also see that certificate is still based on the domain of 2018, thus is invalid. So I think that the issue is caused by the SSL configuration based on domain X while it is iinitiated for domain Y. But since I am not able to reach the site neither the admin panel, I am wondering how I can disable the SSL/HTTPS enforcement so that I can reach the site and admin panel?
I do have access to SSH, so probably I should be able to do something from there? But totally not known with that type OS and usage via SSH.

Bitnami Engineer here,
As you created a snapshot of the 2018 instance, the new instance has the same configuration you had at that time. Please check the following items so you can update the certificates and the app's configuration to work properly using your new domain name:
The certificates are configured in the /opt/bitnami/apache2/conf folder by default. You probably substituted the ones we include with valid certificate files for your domain in 2018. You will need to substitute the server.crt and server.key now with the new ones.
https://docs.bitnami.com/aws/apps/wordpress/administration/enable-https-ssl-apache/
Regarding the WordPress configuration, we have configuration tool that takes care of updating the domain name in the database. Can you take a look at this guide?
https://docs.bitnami.com/aws/faq/configuration/configure-custom-domain/
You will basically need to run sudo /opt/bitnami/apps/wordpress/bnconfig --machine_hostname my-new-domain.com.
I also suggest you check the WordPress' configuration file (/opt/bitnami/apps/wordpress/htdocs/wp-config.php) to see if you edited the WP_HOME and WP_SITE parameters there.

Related

Azure Bitnami WordPress: Cannot get third-party SSL cert to be picked up by server

I'm following this documentation to finalize SSL configuration, using a third-party-provided certificate, but having issues: https://docs.bitnami.com/azure/apps/wordpress/administration/enable-https-ssl-apache/
I've added the following entries to /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf, in order to replace the working LetsEncrypt certificates with my new ones. (domain names are obviously obfuscated in the file screenshot, but it does match filenames in the directory)
Here is a screenshot showing the directory where the certificates are held. Permissions look correct, I believe.
After getting the configuration in place, I restarted all Bitnami services, and even Apache explicitly, but this new cert doesn't seem to get picked up by the server/browser.
Did I miss something? Perplexed here....
Bitnami Engineer here,
You are editing the SSL certificates to use for the default VirtualHost of Apache. However, the WordPress app also has another VirtualHost for it. In order to use the new SSL certificates when accessing WordPress, you will need to edit the /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf file.
Note: I'll notify the Bitnami documentation team to update the documentation accordingly.

Wordpress wp-admin Redirects to EC2 domain

I'm trying to install my wordpress to AWS EC2.
I created my EC2 instance and send files to that. (and instance domain has ben blablabla.eu-west-1.compute.amazonaws.com)
I used aws certificate manager for my domain.
I used cloudfront for using ssl certificate and; values are:
origin: blablabla.eu-west-1.compute.amazonaws.com
cnames: mysite.com
But when I connect to mysite.com/wp-admin it redirects me to blablabla.eu-west-1.compute.amazonaws.com.
Yes, I tried to change siteurl and home variables. And it doesnt make any changes.
And other hand; when I try to connect with "mysite.com" it converts all files to http (buy when I try to connect wit blabla.eu... all files are https)
What should I make?
Can be various things but I assume (based on previous experience) that some strings in Wordpress still contain mysite.com.
Before you go any further, it's worth to note that you can migrate your domain mysite.com to cloudfront/ec2/acm.
But if you want to just switch to another domain what I usually do is that I install wordpress CLI https://wp-cli.org/ and then I run wp-cli search-replace mysite.com blablabla.eu-west-1.compute.amazonaws.com --all-tables. It's good to have a backup just in case something went wrong, but this worked for me multiple times without any issues.

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.

How do I set up AWS Route 53 to handle an EC2 single instance domain

I have thoroughly reviewed both the Amazon Web Services documentation and many Stackoverflow posts related to my issue, but have not yet resolved it. My situation:
I have successfully set up:
an EC2 t2.micro instance with elastic IP, running Ubuntu 14.04.01 /
Apache2 / PHP / MySQL (LAMP)
WordPress 4.5 as a content management system
CiviCRM 4.1 as a constituent management app
I am able to access and run this configuration with the public DNS linked to the Elastic IP. I have a custom domain (mydomain.org) registered through Amazon Route 53 and have set up the necessary record sets (A, CNAME) to connect both mydomain.org and www.mydomain.org to the EIP. This configuration, accessed with HTTP, correctly serves the base page of the app, and I see what I expect from WordPress, with mydomain.org showing in the browser address window.
When I navigate to any other page, it breaks. I see the page, but the displayed URL is that of the EIP public DNS, not my custom domain. I suspect that rewriting the URL in the Virtual Hosts section of my provide a solution, but I haven't been able to determine the proper statements.
Further, I need to have this configuration support TLS / HTTPS. I have successfully obtained and installed the necessary certificates and set them up in my server configuration. I have edited the ssl.conf Virtual Hosts file, and have even been able, using HTTPS to successfully navigate to the base page of WordPress. It shows the basic HTML of the page, but all of the script driven formatting is missing. Again, navigating to any other page of the app breaks the TLS by using the EIP URL, not my custom URL.
I suspect the same solution to the initial issue will fix this issue, as well.
Thank you, in advance, for your advice and suggestions.
Bruce P pointed me in a good direction. I checked VirtualHosts in my .conf file; found it OK. Looked for httpd.conf without success, and reviewed my WordPress configuration, which is where I found the problem. The server information was not updated to reflect the changed URL. When I did that, all significant problems were resolved. Thanks, again, to Bruce P for pointing me in a good direction.
DVH

Putting domain name for wordpress instead of Public domain given by in aws-ec2

I signed-up in AWS(Amazon Web server) for my Wordpress site. I also installed wordpress through AWS-ec2. I followed the steps inside AWs-ec2 documentation like LAMP and others needed.As I go through inside AWS-EC2 environment, I launched an instance where i can work for my Wordpress. Having an instance creates a default public domain name for my wordpress (http://ec2-xxx-xx-xxx-xx.us-west-2.compute.amazonaws.com/).
Now, my problem is I want to make our own domain name like example.com as our wordpress site instead of default domain name given by AWS-ec2. and, what are other requirements or tools needed to deploy it? We bought our domain name in GoDaddy.
Your answers will be highly appreciated.Thank you.
DNS
You need to start with setting up DNS. To do this you can use the service provided by Godaddy or use Route53 in amazon. You will set up records to point to your instance.
Apache
If you are using Virtualhosts, you will need to set up your Virtualhost to respond to the new domain name. If you are not using virtual hosting, it will return the same site regardless of which domain you used.
Wordpress
Wordpress does save the domain you installed it with in the settings. If you change the domain these settings may cause some issues. If you can't get into the Admin UI to fix this, update wp_options table in mysql.

Resources