Map .com to EC2
August 7, 2025 · AI Conversations
—
### **1. Update DNS Settings for `.com` Domain**
Go to your domain registrar (e.g., GoDaddy, Namecheap, etc.) for your `.com` domain and:
– **Create an A record** for `@` (root domain) and `www` (optional) pointing to your EC2 instance’s **public IPv4 address**.
– Example:
Type: A
Host: @
Value: 16.170.254.93 (your EC2 IP)
TTL: 600
– Optional (for www):
Type: A
Host: www
Value: 16.170.254.93
TTL: 600
—
### **2. Configure Your Web Server (Apache/Nginx)**
Ensure your web server is set up to respond to both domains.
**If using Apache**, add the `.com` ServerAlias to your existing VirtualHost:
<VirtualHost *:80>
ServerName example.in
ServerAlias www.example.in example.com www.example.com
DocumentRoot /var/www/share/public
...
</VirtualHost>
**If using Nginx**, modify your server block:
server {
listen 80;
server_name example.in www.example.in example.com www.example.com;
root /var/www/share/public;
...
}
—
### **3. (Optional) Add SSL for `.com`**
If you're using SSL (e.g., with Let's Encrypt), run:
sudo certbot --apache -d example.com -d www.example.com
Or for Nginx:
sudo certbot --nginx -d example.com -d www.example.com
Make sure your SSL covers both `.in` and `.com` domains.
—
### **4. Restart Your Web Server**
After changes:
sudo systemctl restart apache2
# or for Nginx
sudo systemctl restart nginx
—
Would you like help setting up a wildcard SSL for both domains via Cloudflare or Let's Encrypt?
—
### **1. Remove DNS A Records from the Old Instance**
Go to your domain registrar or DNS provider (e.g., Route 53, GoDaddy, Cloudflare):
– **Locate the `.com` DNS zone**
– **Delete** any `A` or `CNAME` records that point to the old instance’s IP (e.g., `@`, `www` records).
—
### **2. Add New DNS A Records for the New Instance**
Now add A records for the `.com` domain pointing to the current EC2 instance (same as `.in`):
Type: A
Name: @
Value: [New EC2 Public IPv4 Address]
TTL: 600
Type: A
Name: www
Value: [New EC2 Public IPv4 Address]
TTL: 600
**Make sure no CDN (like Cloudflare) is caching old values.** Use “development mode” or purge cache if needed.
—
### **3. (Optional) Update Route 53 (If Using It)**
If `.com` is in **Amazon Route 53**, just change the record sets there and remove the ones pointing to the old instance.
—
### **4. Wait for DNS Propagation**
This can take up to **30 minutes to a few hours** depending on TTL settings.
You can verify with:
nslookup example.com
or
dig example.com +short
—
Would you like me to generate the updated DNS records or virtual host config for both domains together?
I want removed from them