Skip to main content
 首页 » 编程设计

python之如何配置 nginx 为另一个域提供特定的 django url 路径

2025年05月04日7虾米哥

我已经配置了 nginx + uwsgi 来服务 foo.com,但是 foo.com/bar/我想像 bar.com 一样服务它

例子: foo.com/bar/test/= bar.com/test/

我还想禁止 bar.com 机器人。

有什么建议吗?

请您参考如下方法:

假设您将 foo.com 配置为:

location / { 
 # your normal stuff 
} 

像这样的东西应该可以工作:

location / { 
   rewrite  ^/bar/(.*)$  bar.com/$1? break; 
} 

关于阻止机器人,请参阅 this nginx forum entry .