google adsence risk, nginx https 200 http 404

Yesterday I found out that my blog google adsence reported the risk as follows:

Earnings at risk - One or more of your sites does not have an ads.txt file. Fix this now to avoid severe impact to your revenue.

So, an ads.txt file is created in the root of the code.

Then verify according to the AdSence Help document;

Found that https and http under codingfailure.com return different results, http return 404, https 304 jump to https://www.linuxcommands.site and return normally;

http:

https:

Confirm that the nginx configuration problem, view the nginx configuration file.

Found two problems:

The first problem, the 443-port server_name is not configured with codingfailure.com, only www.linuxcommands.site.
server {
  listen 443 ssl;
  server_name www.linuxcommands.site;
  access_log /log/www.linuxcommands.site_nginx.log combined;
  index index.html index.htm index.php;
  root /www/wordpress;
  ...
}

The second problem, the 80-port configuration does not handle codingfailure.com.

How to fix this problem?
Port 443, server_name added codingfailure.com.
server {
  listen 443 ssl;
  server_name codingfailure.com www.linuxcommands.site;
  access_log /log/www.linuxcommands.site_nginx.log combined;
  index index.html index.htm index.php;
  root /www/wordpress;
  ...
}

Port 80, the server configuration is modified to:

server {
  listen 80;
  server_name codingfailure.com www.linuxcommands.site;
  return 301 https://$host$request_uri;
}

service nginx restart
Success!

Add a Comment

Your email address will not be published. Required fields are marked *