Usage
location /robots.txt {
log_not_found off;
access_log off;
try_files $uri $uri/ /wp-content/themes/placeholder-theme/robots.php;
location ~ /robots.txt {
rewrite /robots.txt /wp-content/themes/placeholder-theme/robots.php break;
header_filter_by_lua_block {
local ttl = ngx.var.upstream_http_expires or 60
ngx.header["Cache-Control"] = "max-age=" .. ttl
ngx.header["expires"] = ttl
ngx.header["Content-Type"] = "text/plain; charset=utf-8"
}
fastcgi_param REMOTE_ADDR $http_x_real_ip;
# ... (other fastcgi_params)
fastcgi_pass php-fpm;
}
} Last updated