我在一台主机中有Tomcate项目,我希望nginx重定向并传递如下请求:
ui.mysite.com >> www.mysite.com:2121/index_ui.html (*)
ui.mysite.com/index_ui.html >> www.mysite.com:2121/index_ui.html (**)
ui.mysite.com/everyThing >> www.mysite.com:2121/everyThing (all other)
ui.mysite.com/style.css >> www.mysite.com:2121/style.css
ui.mysite.com/js.js >> www.mysite.com:2121/js.js
我有下面的代码,但是它将所有请求重定向到www.mysite.com/everyThing
server {
listen 80;
server_name you.mysite.com ;
rewrite ^(?!(/index_ui.html)).*$ htt://www.mysite.com/$1 temporary;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass htt://www.mysite.com:2121/index_ui.html;
} }