请问如何在api地址前面自定义前缀啊,就是测试发送时的api url那里
Closed this issue · 3 comments
christan-duplicate commented
请问如何在api地址前面自定义前缀啊,就是测试时的api url那里
luoyunchong commented
如果 你要nginx 代理跑 ,然后加前缀。可以参考 其他 issues
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "API V1", Version = "v1" });
c.AddServer(new OpenApiServer()
{
Url = "http://localhost:81/admin/",
Description = "vvv"
});
}
nginx配置
server {
listen 81;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location ^~ /admin/ {
proxy_pass http://localhost:5000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
本来项目 http://localhost:5000/index.html#/home 就能运行跑。
现在 localhost:81/admin 也可访问。
christan-duplicate commented
luoyunchong commented
做不了。。