Overview
If you see the following warning in Google AdSense:
“Earnings at risk – You need to fix some ads.txt file issues to avoid severe impact on your revenue.”
You need to correctly configure the ads.txt
file on your AWS Lightsail instance running Bitnami WordPress. This guide explains the steps to do so.
Steps to Fix ads.txt
Issue
1. Obtain Your ads.txt
File Content
- Log in to your Google AdSense account.
- Navigate to Sites and select your domain.
- If there’s a warning about
ads.txt
, download the provided file or create one manually with the following content:
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
Replace pub-XXXXXXXXXXXXXXXX
with your own AdSense Publisher ID (found in AdSense settings).
2. Connect to Your Lightsail Instance via SSH
- Open the AWS Lightsail dashboard.
- Click on your WordPress instance.
- Click “Connect using SSH” to open the terminal.
3. Upload the ads.txt
File to the Correct Location
By default, Bitnami WordPress serves content from /opt/bitnami/wordpress/
. Place the ads.txt
file there:
cd /opt/bitnami/wordpress/
sudo nano ads.txt
Paste your ads.txt
content and save it (Ctrl + X
, then Y
, then Enter
).
Alternatively, create the file using a single command:
echo "google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0" | sudo tee /opt/bitnami/wordpress/ads.txt
4. Adjust File Permissions
Ensure the file has the correct permissions:
sudo chown bitnami:daemon /opt/bitnami/wordpress/ads.txt
sudo chmod 644 /opt/bitnami/wordpress/ads.txt
5. Restart Apache
To apply changes, restart Apache:
sudo /opt/bitnami/ctlscript.sh restart apache
6. Verify ads.txt
Availability
Check if your ads.txt
is accessible by opening the following URL in your browser:
https://yourdomain.com/ads.txt
Alternatively, use curl
to verify:
curl -I https://yourdomain.com/ads.txt
If successful, you should see HTTP/1.1 200 OK
.
7. Clearing Cache (If Needed)
If you get a 404 error, try the following:
- Disable caching plugins in WordPress.
- Clear Cloudflare cache if you’re using a CDN.
- Force refresh in your browser (
Ctrl + Shift + R
). - Retry after some time (Google may take a few hours to recognize changes).
Alternative: Use a WordPress Plugin
If manually adding ads.txt
does not work, use the “Ads.txt Manager” plugin:
- Install and activate Ads.txt Manager from the WordPress plugin directory.
- Go to Settings → Ads.txt.
- Paste your
ads.txt
content and save.
Conclusion
Once set up correctly, the AdSense warning should disappear within 24-48 hours. If the issue persists, double-check file permissions, caching, and ensure the correct placement of the ads.txt
file.