server{listen80;location/{root/opt/docker_dir/nginx/html/demo;indexindex.htmlindex.htm;}location^~/api/v1{proxy_passhttp://127.0.0.1:18080;mirror/mirror;#指定镜像的url
mirror_request_bodyon;#是否镜像请求body部分
proxy_set_headerHost$host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerREMOTE-HOST$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;}# 镜像站点配置
location/mirror{internal;#设置这个location为内部配置,外部的调用请求会返回404
proxy_passhttp://127.0.0.1:28080$request_uri;#指定将镜像数据发送到哪
proxy_pass_request_bodyon;# Indicates whether the original request body is passed to the proxied server. default value is on
proxy_set_headerX-Original-URI$request_uri;# reset uri
}}