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

标签 python django nginx

我已经配置了 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 .

关于python - 如何配置 nginx 为另一个域提供特定的 django url 路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10357675/

相关文章:

python - QTreeView 小部件默认大小占用最大屏幕空间

php - 带有 nginx、mysql、php7 和 slimphp 的 Dockerfile

python - 如何使用OpenCV和Python对图像进行运动模糊处理?

django - 尽管调用正常,但测试 Django Rest Framework POST 返回 500

python - Django - 模板上的 Pysftp 身份验证错误

python - 时区 "Eastern Standard Time"无法识别

javascript - Wordpress 和 Varnish 破坏 loadscript.php 的问题

nginx - Luasocket + nginx 错误 - lua 入口线程中止 : runtime error: attempt to yield across C-call boundary

python - 如果模型名称是应用程序名称,如何使 Django 模型不将应用程序名称添加到模型中?

python - 在编译这样的代码时出现错误 'NoneType' 对象没有属性 'find_all'