Posts
multiple robots.txt file for multiple domains in nginx
03 Jul 2010
Tags:
nginx, robots, multiple domains
If you're using nginx and need to use different robots.txt file for different domains, then just follow the following examples.
plain
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com/public;
passenger_enabled on;
rails_env production;
#this one uses robots.txt so we don't need to add an alias
}
server {
listen 80;
server_name sample.com www.sample.com;
root /var/www/example.com/public;
passenger_enabled on;
rails_env production;
location /robots.txt {
alias /var/www/example.com/public/sample_robots.txt;
}
}