Nginx Return指令使用
#Return指令使用:1.返回状态码
return 404;
2.返回字符串
return 200 'hello';
3.地址跳转
return http://www.baidu.com;
4.返回自定义变量
set $name 'user123';
return 200 $name;
5.返回内置变量
return $uri;
6.返回日志信息实例
return200 '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
7.curl测试
curl http://192.168.2.1/test?id=10 -H "referer: 192.168.1.1" -H "x-forwarded-for: 192.168.3.3"
页:
[1]