You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

新手求助:不使用Route 53将域名映射到Amazon EC2实例的详细步骤

Point Your Domain to Bitnami WordPress on EC2 (No Route 53 Needed)

Hey there! I’ve walked through this exact setup multiple times, so let’s break down how to map your domain to your Bitnami WordPress EC2 instance without using AWS Route 53. Follow these steps carefully, and you’ll be up and running in no time.

1. Get Your EC2 Instance’s Stable Public IP (Use Elastic IP)

Regular public IPs change when you restart your instance—so always use an Elastic IP for a fixed address:

  • Log into your AWS Console, navigate to the EC2 dashboard.
  • Locate your Bitnami WordPress instance, then go to Actions > Networking > Manage Elastic IPs.
  • If you don’t have an Elastic IP yet, click Allocate Elastic IP address and confirm the allocation.
  • Select the new Elastic IP, click Actions > Associate Elastic IP address, pick your EC2 instance from the dropdown, and save.
  • Jot down this Elastic IP—you’ll need it for DNS setup later.

2. Update EC2 Security Group to Allow Web Traffic

Your instance’s security group needs to let HTTP/HTTPS traffic reach it:

  • Go back to your EC2 instance details, click the linked security group under the "Security" section.
  • In the Inbound rules tab, click Edit inbound rules.
  • Add two new rules:
    • Type: HTTP, Protocol: TCP, Port range: 80, Source: 0.0.0.0/0 (lets all users access your site via HTTP)
    • Type: HTTPS, Protocol: TCP, Port range: 443, Source: 0.0.0.0/0 (enables secure HTTPS access)
  • Make sure your SSH rule (port 22) is still present so you can log into the instance later.
  • Save the rules.

3. Configure DNS Records at Your Domain Registrar

Head over to your domain registrar (like Namecheap, GoDaddy, etc.) to point your domain to the Elastic IP:

  • Log into your registrar’s dashboard, find the DNS Management or Nameservers section for your domain.
  • Add A Records (maps domains directly to IP addresses):
    • For your root domain (e.g., yourdomain.com): Set Host Record to @, Value to your Elastic IP, TTL to 300 (5 minutes, speeds up propagation).
    • For the www subdomain (e.g., www.yourdomain.com): Either add another A Record with Host Record www and the same Elastic IP, or add a CNAME Record with Host Record www pointing to @ (your root domain).
  • Save the DNS changes. Note: Propagation can take 5 minutes to 24 hours, but usually completes within an hour.

4. Update Bitnami WordPress Configuration

This is the critical step—Bitnami uses specific config files to link your domain:

4.1 SSH Into Your EC2 Instance

Use your AWS key pair to log in via SSH. Open your terminal and run:

ssh -i "your-key-pair-file.pem" bitnami@your-elastic-ip

(Replace your-key-pair-file.pem with the path to your downloaded key pair, and your-elastic-ip with your instance’s Elastic IP.)

4.2 Update WordPress Core Settings

Edit the wp-config.php file to set your domain as the home and site URL:

sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

Find or add the lines for WP_HOME and WP_SITEURL (add them at the bottom if missing):

define('WP_HOME','http://yourdomain.com');
define('WP_SITEURL','http://yourdomain.com');

(Replace yourdomain.com with your actual domain. If you plan to use HTTPS, change http to https now.)
Press Ctrl+O to save, then Ctrl+X to exit nano.

4.3 Update Apache Virtual Host Config

Bitnami uses Apache, so we need to update its config to recognize your domain:
First, edit the main Apache config:

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

Find the <VirtualHost _default_:80> block, update ServerName and add a ServerAlias (for the www subdomain):

ServerName yourdomain.com
ServerAlias www.yourdomain.com

Save and exit nano.

If you plan to use HTTPS (highly recommended), edit the SSL config too:

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami-ssl.conf

Find the <VirtualHost _default_:443> block and update ServerName and ServerAlias the same way:

ServerName yourdomain.com
ServerAlias www.yourdomain.com

Save and exit.

4.4 Restart Apache to Apply Changes

Run this command to restart the Apache server:

sudo /opt/bitnami/ctlscript.sh restart apache

5. Verify the Setup

Wait for DNS propagation to finish, then open your browser and type in your domain. You should see your Bitnami WordPress site load correctly.

If you run into issues:

  • Check DNS propagation: Run nslookup yourdomain.com in your terminal—if it returns your Elastic IP, propagation is done.
  • Check Apache logs for errors: Run tail /opt/bitnami/apache2/logs/error_log to debug issues.
  • Fix file permissions: If you modified files, run sudo chown -R bitnami:bitnami /opt/bitnami/apps/wordpress/htdocs to ensure correct ownership.

Bonus: Enable Free SSL with Let’s Encrypt

Bitnami has a built-in tool to make this easy. Run:

sudo /opt/bitnami/bncert-tool

Follow the on-screen prompts to set up SSL—this will automatically update your config to use HTTPS and redirect HTTP traffic to HTTPS.


内容的提问来源于stack exchange,提问作者Aly Mansour

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:45:59