我已经配置了nginx + uwsgi来服务foo.com,但foo.com/bar/我想像bar.com一样提供服务
例如: foo.com/bar/test/ = bar.com/test /
我也想让bar.com机器人不被允许。
任何建议?
答案 0 :(得分:1)
假设您已将foo.com
配置为:
location / {
# your normal stuff
}
这样的事情应该有效:
location / {
rewrite ^/bar/(.*)$ bar.com/$1? break;
}
要阻止机器人,请参阅this nginx forum entry。
答案 1 :(得分:0)
server {
listen 80;
server_name foo.com;
root /full/server/path/to/foo/folder;
index index.html index.php;
# This redirects anyone that directly types "foo.com/bar/xyz to bar.com/xyz"
if ($request_uri ~ ^/bar(.*)$) {
return 301 http://bar.com$1;
# Alternative for old nginx versions
# rewrite ^ http://bar.com$1 redirect;
}
# foo.com location blocks go below
...
}
server {
listen 80;
server_name bar.com;
root /full/server/path/to/foo/bar/folder;
index index.html index.php;
# bar.com location blocks go below
...
}