如何将域映射到另一个域的子文件夹?

时间:2022-08-23 10:11:33

I have a very fast web server (IIS6, ASP.NET) that I want to use for several sites. Now, I already have a domain that maps directly to the IP address of the server, but how can I get another domain to map to a subfolder (i.e., a separate ASP.NET application) on that same computer? Is it theoretically possible? (note: only port 80 is open, I cannot open other ones.)

我有一个非常快速的web服务器(IIS6, ASP.NET),我想在几个站点上使用它。现在,我已经有了一个域可以直接映射到服务器的IP地址,但是我如何才能让另一个域映射到子文件夹(例如。,一个单独的ASP。NET应用程序)在同一台计算机上?这是理论上可行吗?(注意:只有80端口是打开的,我不能打开其他端口。)

Accepted answer: shown below. I actually followed the tutorial and got it working. Hooray! Thanks, everyone! :)

答:接受如下所示。实际上,我遵循了教程,并使它工作。万岁!谢谢,大家好!:)

3 个解决方案

#1


4  

Sure, you could do it with domain host headers. Just create a new web site and chose a different host header (e.g. www.example.com) and let it point to the desired folder. You can create hundreds of web sites on a single server, if you like.

当然,你可以用域主机头来做。只需创建一个新的web站点并选择一个不同的主机头(例如www.example.com),并让它指向所需的文件夹。如果您愿意,可以在一个服务器上创建数百个web站点。

Here is a tutorial how to do this.

这里有一个如何做到这一点的教程。

  1. Open IIS Manager
  2. 打开IIS管理器
  3. On the left side, expand your computer name, then click "Web Sites", right click in the right side, put your mouse over "New" and select "Web Site..."
  4. 在左边,展开你的计算机名称,然后点击“Web站点”,在右边右键点击,将鼠标放在“New”上,选择“Web站点…”
  5. Click Next in the dialog, then put in a description of the new web site you are creating (can be anything)
  6. 在对话框中单击Next,然后输入要创建的新web站点的描述(可以是任何内容)
  7. Click Next again and go to the last text box and put in what you want the new Host Header to be
  8. 再次单击Next,进入最后一个文本框,并输入您想要的新主机头
  9. Now put in the path to your new site and make sure you keep "Allow anonymous access" checked
  10. 现在,在你的新网站的路径上,确保你保持“允许匿名访问”的检查。
  11. Check "Run scripts" (for ASP.NET execution) if it's not already checked.
  12. 检查“运行脚本”(用于ASP)。如果尚未检查,则执行NET执行。
  13. Click Finish on the next dialog and you're done!
  14. 在下一个对话框中单击Finish,您就完成了!

#2


0  

Just create a new site in your "IIS Manager" application - the wizard will ask for the DNS hostname of the new site.

只要在“IIS管理器”应用程序中创建一个新站点,向导就会请求新站点的DNS主机名。

To see (or change) that value later, on the "Web Site" tab of the properties pages for that site, use the "Advanced..." options to chose which values for the HTTP/1.1 "Host:" header are used to get to that particular site.

要查看(或更改)该值,请在该站点的属性页的“Web站点”选项卡上使用“Advanced…”选项,以选择HTTP/1.1“Host:”头的哪个值用于访问该特定站点。

#3


0  

Does it have to be a subfolder? You can setup a different site in iis and use host headers to direct each domain to the relevant site, all using one ip.

它必须是子文件夹吗?您可以在iis中设置不同的站点,并使用主机头将每个域指向相关的站点,所有这些都使用一个ip。

You can't do this if you need ssl though; you really need multiple ips for that.

如果需要ssl,就不能这样做;你确实需要多个ip。

If it has to be a subdir you can create another site as above and set it to redirect to somewhere else.

如果它必须是subdir,您可以创建上面所示的另一个站点,并将其设置为重定向到其他地方。

#1


4  

Sure, you could do it with domain host headers. Just create a new web site and chose a different host header (e.g. www.example.com) and let it point to the desired folder. You can create hundreds of web sites on a single server, if you like.

当然,你可以用域主机头来做。只需创建一个新的web站点并选择一个不同的主机头(例如www.example.com),并让它指向所需的文件夹。如果您愿意,可以在一个服务器上创建数百个web站点。

Here is a tutorial how to do this.

这里有一个如何做到这一点的教程。

  1. Open IIS Manager
  2. 打开IIS管理器
  3. On the left side, expand your computer name, then click "Web Sites", right click in the right side, put your mouse over "New" and select "Web Site..."
  4. 在左边,展开你的计算机名称,然后点击“Web站点”,在右边右键点击,将鼠标放在“New”上,选择“Web站点…”
  5. Click Next in the dialog, then put in a description of the new web site you are creating (can be anything)
  6. 在对话框中单击Next,然后输入要创建的新web站点的描述(可以是任何内容)
  7. Click Next again and go to the last text box and put in what you want the new Host Header to be
  8. 再次单击Next,进入最后一个文本框,并输入您想要的新主机头
  9. Now put in the path to your new site and make sure you keep "Allow anonymous access" checked
  10. 现在,在你的新网站的路径上,确保你保持“允许匿名访问”的检查。
  11. Check "Run scripts" (for ASP.NET execution) if it's not already checked.
  12. 检查“运行脚本”(用于ASP)。如果尚未检查,则执行NET执行。
  13. Click Finish on the next dialog and you're done!
  14. 在下一个对话框中单击Finish,您就完成了!

#2


0  

Just create a new site in your "IIS Manager" application - the wizard will ask for the DNS hostname of the new site.

只要在“IIS管理器”应用程序中创建一个新站点,向导就会请求新站点的DNS主机名。

To see (or change) that value later, on the "Web Site" tab of the properties pages for that site, use the "Advanced..." options to chose which values for the HTTP/1.1 "Host:" header are used to get to that particular site.

要查看(或更改)该值,请在该站点的属性页的“Web站点”选项卡上使用“Advanced…”选项,以选择HTTP/1.1“Host:”头的哪个值用于访问该特定站点。

#3


0  

Does it have to be a subfolder? You can setup a different site in iis and use host headers to direct each domain to the relevant site, all using one ip.

它必须是子文件夹吗?您可以在iis中设置不同的站点,并使用主机头将每个域指向相关的站点,所有这些都使用一个ip。

You can't do this if you need ssl though; you really need multiple ips for that.

如果需要ssl,就不能这样做;你确实需要多个ip。

If it has to be a subdir you can create another site as above and set it to redirect to somewhere else.

如果它必须是subdir,您可以创建上面所示的另一个站点,并将其设置为重定向到其他地方。