简体   繁体   English

XP Pro IIS 上的 Localhost 子域?

[英]Localhost subdomain on XP Pro IIS?

Is there a way to setup subdomains udner Xp Pro IIS for something like test.localhost有没有办法为 test.localhost 之类的东西设置子域 udner Xp Pro IIS

Can it be done via IIS or the hosts file?可以通过 IIS 或主机文件完成吗? Need to do a tets on a site that uses pathign back to the root so having the site ina virtual directory like localhost/test causes issues.需要在使用 pathign 回到根目录的站点上执行 tets,因此将站点置于 localhost/test 之类的虚拟目录中会导致问题。

As you're probably well aware that out of the box IIS 5.1 only supports one web site.您可能很清楚开箱即用的 IIS 5.1 仅支持一个 web 站点。 What you can do is use the adsutil.vbs tool to create a second site in IIS 5.1 and configure it to use that.您可以做的是使用adsutil.vbs工具在 IIS 5.1 中创建第二个站点并将其配置为使用该站点。

The following article explains the process:下面的文章解释了这个过程:

IIS: Creating Multiple Web Sites within IIS on Windows 2000 and Windows XP Professional IIS:在 IIS 内创建多个 Web 站点,在 Windows 2000 和 Windows XP Professional

There's even a GUI widget to make life easy:甚至还有一个 GUI 小部件让生活变得轻松:

http://www.firstserved.net/support/downloads http://www.firstserved.net/support/downloads

So in a nutshell:所以简而言之:

  1. Create a second site using one of the methods above (set the IP address to your machine's primary IP address)使用上述方法之一创建第二个站点(将 IP 地址设置为您机器的主 IP 地址)
  2. Add a host header for test.localhost domain to the new site为新站点添加一个主机 header 为test.localhost
  3. Edit the HOSTS and add an entry for test.localhost pointing at the IP address above编辑 HOSTS 并为test.localhost添加一个条目,指向上面的 IP 地址

Easiest way is to just switch the document root of the lone site you already have to the different folder with the target site.最简单的方法是将您已有的单独站点的文档根目录切换到目标站点的不同文件夹。 Then you can switch it back when done.然后你可以在完成后将其切换回来。

If you are building stuff in virtual directories off the root, this shouldn't even effect any ongoing projects.如果您在根目录之外的虚拟目录中构建内容,这甚至不会影响任何正在进行的项目。

I seem to recall there was a tool which did this for you, but I've forgotten it's name and coordinates.我似乎记得有一个工具可以为您完成此操作,但我忘记了它的名称和坐标。

Create a new website in IIS. The host header value should be your subdomain like "sub.localhost", and then add the domain to your hosts file.在 IIS 中创建一个新网站。主机 header 值应该是您的子域,如“sub.localhost”,然后将域添加到您的主机文件中。

open with notepad the file c:\windows\system32\drivers\etc用记事本打开文件 c:\windows\system32\drivers\etc

and add this line:并添加这一行:

 127.0.0.1 mysuper-site.com.net.blabla

Then browse to this site: http://mysuper-site.com.net.blabla然后浏览到这个网站: http://mysuper-site.com.net.blabla

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM