If the domain is managed through Cloudflare, we’ll need to update DNS settings in Cloudflare. Here’s how to do it:
Step 1: Find Your EC2 Instance’s Public IP Address
- Go to the AWS EC2 dashboard.
- Find your instance and note its public IP address.

Step 2: Update DNS Records in Cloudflare
Log in to Cloudflare. Access your Cloudflare account and select Your Domain. Navigate to DNS Settings:

Add or Modify A Record. You’ll need to add or modify an A record to point to your EC2 instance’s public IP address. If an A record for your domain (or subdomain) already exists, edit it.

Otherwise, add a new A record:
- Type:
A
- Name:
@
(for the root domain) or the name of your subdomain (e.g.,www
). - IPv4 address: Enter the public IP address of your EC2 instance.
- Proxy status: Decide if you want Cloudflare’s CDN and protection. Typically, you’d choose “Proxied” for the additional features Cloudflare offers.
- Save your changes.
Step 3: Allow Time for Propagation
DNS changes can take some time to propagate across the internet. This can range from a few minutes to up to 48 hours in some cases, although it’s usually on the shorter side with Cloudflare.
Step 4: Configure Web Server for the Domain (Optional but Recommended)
Ensure your Nginx or Apache server on the EC2 instance is configured to respond to requests for your domain. This involves updating the server_name
directive in your server block (for Nginx) or the ServerName directive in your virtual host configuration (for Apache) to include your domain name.
ssh ec2winjob
sudo nano /etc/nginx/conf.d/winjob.conf
update the server_name
server {
listen 80;
listen [::]:80;
server_name winjob.ai www.winjob.ai;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
After making changes to the configuration file, check for syntax errors:
sudo nginx -t
If the syntax check passes, restart Nginx to apply the changes:
sudo systemctl restart nginx
Note: if you haven’t set up SSL, and if you are using Cloudflare, you might see this:

Changing the setting of SSL on the Cloudflare to “Flexible” can solve this problem.
