英文:
Domain + subdomain IIS deployment
问题
我有两个网站。第一个是asp.net core web ui。第二个是golang api。我还购买了域名foo.bar(例如)。我需要两个网站:
- foo.bar - asp.net ui
- api.foo.bar - go api
我该如何在iis上部署它们?
我的go服务器运行在8080端口。我尝试创建两个站点:
- 空主机名
- 主机名:api.foo.bar
foo.bar(ui)可以正常工作
我还尝试使用iis规则将api流量重定向到8080端口,但它不起作用。对于api.foo.bar,我只得到404错误。
唯一能正常打开的是在服务器浏览器中输入api.foo.bar:8080。
英文:
I have two web-sites. First is asp.net core web ui. Second is golang api. Also I have bought domain. foo.bar (for example). I need two web-sites:
- foo.bar - asp.net ui
- api.foo.bar - go api
How can I deploy that on iis?
My go-server works on port 8080. I tried create two sites:
- with blank hostname
- hostname: api.foo.bar
And foo.bar (ui) works
Also I tried redirect api-traffic to port 8080 with iis rule but it doesn't work. For api.foo.bar I just get error 404.
The only thing I get is that api.foo.bar:8080 opens correctly on from server's browser.
答案1
得分: 0
我创建了两个站点:
- foo.bar(用于 asp.net ui),主机名为空;
- 主机名:api.foo.bar,用于 API。
然后我在 web.config 中为 API 站点添加了重写规则:
<rewrite>
<rules>
<remove name="ReverseProxyInboundRule1" />
<rule name="ReverseProxyInboundRule1" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<action type="Rewrite" url="http://localhost:8080/{R:0}" />
</rule>
</rules>
</rewrite>
一切都正常工作了。
英文:
I created two sites:
- foo.bar (for asp.net ui) with blank hostname;
- hostname: api.foo.bar for api.
Then I put rewrite-rule in web.config for api-site:
<rewrite>
<rules>
<remove name="ReverseProxyInboundRule1" />
<rule name="ReverseProxyInboundRule1" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<action type="Rewrite" url="http://localhost:8080/{R:0}" />
</rule>
</rules>
</rewrite>
And everything worked
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论