如何在IIS的一个网站上提供两个文件夹(React构建文件)? [英] How to serve two folders (React build files) on one website on IIS?

查看:49
本文介绍了如何在IIS的一个网站上提供两个文件夹(React构建文件)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有IIS Web服务器,并且正在使用IP地址和:80端口来服务网站.

I have IIS web server, and I am using the IP address and :80 port to serve the website.

我有两个申请.其中一个应该在"/"路由上投放,而另一个应该在"/admin"路由上访问.

I have two applications. One of them should be served on '/' route, and another one should be accessible on '/admin' route.

我尝试了有关如何在一个IP和端口上服务两个网站"的多种建议,但它们对我没有帮助.我还用静态文件创建了虚拟目录,但仍然无法通过"/admin"路由访问第二个应用程序

I tried multiple advices about "how to serve two websites on one IP and Port", but they do not help me. I also created virtual directory with static files, but still cannot access the second app on '/admin' route

可以请给我一些建议,我需要添加到"web.config"中才能使其正常工作.我希望"app1"位于本地路由上,即"/"和"app2"位于"/admin"路由上,所以

Can you please give me recommendations what do I need to add to "web.config" to make it work. I want the "app1" be on home route, that it, '/', and "app2" be on the "/admin" route, so

111.111.11.11/-这是"app1"

111.111.11.11/ - this is "app1"

111.111.11.11/大约-这仍然是"app1"

111.111.11.11/about - this is still "app1"

111.111.11.11/admin-当用于admin时,它是"app2"

111.111.11.11/admin - and when the use goes to admin, this is "app2"

推荐答案

首先,在邮件应用程序下创建子应用程序或虚拟目录.提供完整的访问控制isur和iis_iusrs.

First, create child application or virtual directory under the mail application. give full access control isur and iis_iusrs.

将所有绝对链接转换为相对链接.基本标记仅适用于相对URL.最低限度的纯HTML示例.

Convert all absolute links to relative ones. Base tag works only for relative URLs. The bare minimum plain HTML example.

<img src="/assets/logo.svg"/> to <img src="./assets/logo.svg"/>

添加您的index.html.此标记应放置在...中,然后再使用其他任何使用URL的元素.最好将它放在index.html中...上方的位置

Add in your index.html. This tag should be placed in the ... before any other element that uses URLs. The best place to put it right above the ... in the index.html

    <head>
  ...
  <base href="%PUBLIC_URL%/">
  <title>React App</title>
</head>
<body>
  ...
</body>

关于,贾帕(Jalpa)

Regards, Jalpa

这篇关于如何在IIS的一个网站上提供两个文件夹(React构建文件)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆