GoDaddy domain in AWS with SSL for Wordpress appli

2019-06-14 14:54发布

Currently, I am working on a Wordpress application and I am using AWS hosting. My domain is in GoDaddy.com and I have deployed the application in elastic beanstalk. I have created load balancer and also I need to run the application through HTTPS. I have done my research and I think I found the right way, but it's not working for HTTPS. when I browse on HTTP on port 80, it runs well. Now I am helpless.

Here's what I have done so far:
1)   I created a hosted zone on AWS Route 53 for the domain named "example.com". There are two records are created, NS and SOA.
2)   Then, in GoDaddy, I added NS records from AWS as Custom Nameservers.
3)   After that, I created A record for the domain in the AWS hosted zone, set ALIAS targeted to the Load Balancer of the Elastic Beanstalk environment.
4)   Then, I changed the SITE URL from the wp_options table the wordpress application database.

After doing up to this, my application was running in HTTP. But as I want to change it to HTTPS. So,

1)   I requested a certificate from AWS Certificate Manager and created CNAME (provided by ACM after requesting certificate) record in the hosted zone.
2)   After the certificate is issued, I edited the listener from EC2 >> Load Balancer >> Listener and changed the protocol from HTTP to HTTPS and also allowed port on Security groups.
3)   Also, I changed, the SITE URL from WordPress database and changed it from "http://example.com" to "https://example.com" but it was not working.
4)   So I went to Elastic Beanstalk >> Configuration >> Load Balancer and added listener. After the environment is saved and restarted, still, the site was not running on HTTPS [ HTTP 408 ERROR IS SHOWN ]. But if I change SITE URL to "http://example.com", it works

I have found a solution, which says to use RedirectURL and set it to server config but I don't want to do that.

I also found this solution which suggest to Export Zone File and import it to AWS hosted zone. But whenever I click Export Zone File(Unix), the file downloaded is shown empty. I tried this for other accounts, still, this problem exists. So I did not do that.

Sorry for the long story, but I really need this help.

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-06-14 15:36

I have solved the issue.

In my load balancer port configuration, I previously set load Balancer port 443 and instance 443. here what I need to do is to call the load balancer on port 443 and backend make the backend call on port 80 and enable https on WordPress.

So I kept load balancer port 443 and changed the instance port to 80. After that, on the browser, there was too many redirects error shown. So then what I needed to do is that add $_SERVER['HTTPS'] = 'on' on wp-config. And then everything was running smoothly.

enter image description here

I hope this will help if some

查看更多
登录 后发表回答