S
S
Sergey Pugovkin2016-09-23 18:59:10
Nginx
Sergey Pugovkin, 2016-09-23 18:59:10

How to configure nginx to return a specific file for a specific request?

There is such a site config (nginx):

server {
    listen               111.111.111.111:80;
    server_name    site1.ru www.site1.ru;
    root                  /var/www/site1.ru/www;
    include            snippets/fastcgi-php.conf;
}

server {
    listen               111.111.111.111:80;
    server_name    site2.ru www.site2.ru;
    return 301 $scheme://site1.ru/some-url;
}

How to change the second configuration so that the request of the robots (site2.ru/robots.txt) would not issue a 301 redirect, but the contents of the first robots file, i.e. site1.ru/robots.txt ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question