我的目标是重定向这种网址:
http://example.com/cloud/signup?format=json
为:
http://services.example.com/users/create?format=json
所以我想:
我目前的测试是:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name services.example.com;
passenger_enabled on;
rails_env production;
root /home/admin/app/current/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name example.com;
location ~ /cloud(.*) {
return 301 $scheme://services.example.com/users/create?format=json;
}
}
它不起作用。 我是否需要创建2台服务器,或者只使用主服务器进行重定向?