博客
关于我
nginx return知多少
阅读量:184 次
发布时间:2019-02-28

本文共 1141 字,大约阅读时间需要 3 分钟。

Nginx Return ????

Nginx return ?????????????????????????????return ???????????????????? server?location ?? if ??????

?????

return ???????????????????????????URL ??????

??1?

server {    listen 80;    server_name www.aming.com;    return 403;    rewrite /(.*) /abc/$1;  // ??????????}

??2?

server {    listen 80;    server_name www.aming.com;    if ($request_uri ~ "\.htpasswd|\.bak") {        return 404;        rewrite /(.*) /aaa.txt;  // ??????????    }    // ????????}

?????

???????????????????????? JSON ?????????

??3?

server {    listen 80;    server_name www.aming.com;    return 200 "hello;";}

??4?

location ^~ /aming {    default_type application/json;    return 200 '{"name":"aming","id":"100"}';}

??5?

location /test {    return 200 "$host $request_uri";}

?? URL

return ??????????? URL???? URL ? http:// ? https:// ???

??6?

server {    listen 80;    server_name www.aming.com;    return http://www.aminglinux.com/123.html;    rewrite /(.*) /abc/$1;  // ??????????}

????

?????????????????????????

if ($http_referer ~ 'baidu.com') {    return 200 "";}

?????

  • ???? return http://$host$request_uri;??????????????????????????????????????

转载地址:http://ucti.baihongyu.com/

你可能感兴趣的文章
MySQL锁
查看>>
MySQL锁与脏读、不可重复读、幻读详解
查看>>
MySQL锁机制
查看>>
mysql锁机制,主从复制
查看>>
Mysql锁机制,行锁表锁
查看>>
MySQL锁表问题排查
查看>>
Mysql锁(2):表级锁
查看>>
MySQL锁,锁的到底是什么?
查看>>
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
查看>>
Mysql错误2003 -Can't connect toMySQL server on 'localhost'(10061)解决办法
查看>>
MySQL错误提示mysql Statement violates GTID consistency
查看>>
mysql错误:This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its de
查看>>
mysql长事务
查看>>
mysql问题记录
查看>>
MySQL集群解决方案(1):MySQL数据库的集群方案
查看>>
MySQL集群解决方案(4):负载均衡
查看>>
MySQL集群解决方案(5):PXC集群
查看>>
MySQL面试宝典
查看>>
WAP短信:融合传统短信和互联网的新型通信方式
查看>>
mysql面试题学校三表查询_mysql三表查询分组后取每组最大值,mysql面试题。
查看>>