nginx 通过状态码判断url该怎么走

通过nginx返回的状态码来判断url该怎么走,如下是tomcat的静态化操作,当nginx去访问静态文件时,如果没有找到会丢给tomcat去处理

location ^~ /zenghui {
root /www_root;
proxy_intercept_errors on;
error_page 404 = @error_page_404;
error_page 403 = @error_page_404;
}

location @error_page_404 {
set $orginal_uri $uri;
proxy_pass http://wdzj$orginal_uri;

proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

 

posted @ 2015-07-01 13:51  xiaohui163  阅读(2747)  评论(0编辑  收藏  举报