nginx的return指令
cat /etc/nginx/conf.d/return.conf
server {
listen 80;
server_name www.return.com;
root /data/return;
location / {
index index.html;
}
default_type text/html;
charset utf-8;
if ($http_user_agent ~* "chrome|MSIE|firefox") {
return 301 http://dco.zqfstack.cn;
}
}
curl -A "chrome" www.return.com
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.27.0</center>
</body>
</html>
curl www.return.com
return_test