问题
i need rewrite for domain whois for example http://domainname.ltd/example.com
must be call http://domainname.ltd/whois.php?d=example.com
i try location examples but not working.
回答1:
you can do it like this:
server {
listen 80;
server_name test.com;
location = /whois.php {
proxy_pass http://your_origin_host.com
}
location ~ \/(.*) {
set $domain_query $1;
set $args "d=${domain_query}";
rewrite ^ /whois.php last;
}
}
来源:https://stackoverflow.com/questions/58029307/nginx-location-domain-ltd-regex