Nginx如何设置首页跳转到后端服务

我有个需求,需要访问 [url]http://www.openskill.cn[/url] 然后通过nginx配置跳转到我后端tomcat的index.html 下,[url=http://192.168.0.139/index.html]http://192.168.0.139:8080/index.html[/url] 
已邀请:

空心菜 - 心向阳光,茁壮成长

赞同来自: push

1、首先在你的nginx配置文件中加入
index index.html index.htm index.php;

2、配置location
location  = / {
rewrite ^(.*)/index.html last;
proxy_pass http://192.168.0.139:8080/index.html;
}
这样应该就可以了,你可以试试!

空心菜 - 心向阳光,茁壮成长

apache 301跳转:
RewriteEngine on
RewriteRule ^/(.*)$ http://openskill.cn/people/WaterSpinach$1 [R=301]

要回复问题请先登录注册