When I link a domain name to EC2 instance IP, my wordpress setup on the same machine returns 503 error. It runs fine when its not linked to any domain name.
Update: I think I found the reason of error, which would be ELB instance getting 301 as status code, due to redirect (it must be hitting private IP). Still not sure how to fix it though.
Cases:
- If I hit the IP address, it gets redirected to
example.com
and returns 503 error. - If I hit example.com, it simply returns 503 error.
I tried a set of changes, but none of them seem to work. The steps were:
- Add ServerName under /etc/httpd/conf/httpd.conf
- Add SITE_URL and HOME_URL in wp-config (and the relevant changes in functions.php
- Update
site_url
andhome_url
in wp_options table
But none of these seem to fix it
.htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
My original plan was to setup the instance under autoscaling group and load balance it, but even the basic configuration doesn't seem to work. Same thing happens if I link the domain name to ELB url and add the instance under load balancer.