This section expands our ads.txt setup article to cover steps on setting up a 301 redirect for Nginx web servers.

  • Locate your Nginx site configuration.On Unix this is commonly in /etc/nginx/conf/sites-enabledOn Windows look for the conf directory in the directory nginx was installed

  • Open the configuration file for your website.

  • Add the following line in the file, replace #### with the ID of your property, found in your site list in the NitroPay panel.

rewrite ^/ads.txt$ https://api.nitropay.com/v1/ads-####.txt permanent;
  • For example, this might look like:

server {
    . . .
    server_name yourdomain.com www.yourdomain.com;

    rewrite ^/ads.txt$ https://api.nitropay.com/v1/ads-####.txt permanent;
    . . .
}
  • Save the file and restart nginx.

  • Test that the redirect works by going to yourdomain.com/ads.txt and noting that the URL and contents changed to the hosted ads.txt.

Did this answer your question?