It maybe is possible with Nginx but Nginx config is off-topic. Please have a look at the RobotsTxt module instead. The RobotsTxt module simply provides you a /robots.txt route that behaves just like a normal robots.txt file with the difference that you can configure the content of it from the back-end per site. You only need to pay attention that you deleted the physical robots.txt file to let the RobotsTxt module do its work.
Use this module when you are running multiple Drupal sites from a
single code base (multisite) and you need a different robots.txt file
for each one. This module generates the robots.txt file dynamically
and gives you the chance to edit it, on a per-site basis, from the web
Note: You must delete or rename the robots.txt file in the root of your Drupal installation for this module to display its own robots.txt
This solves your robots.txt problem. The ads.txt needs to be solved the same way. You need to create a custom module that does just the same as the RobotsTxt module for the /ads.txt route. With an admin settings form to store its content.