使用Apache2在同一服务器端口上托管多个域

时间:2022-10-05 21:22:26

How do I configure Apache2 via webmin or command-line (I'm using RHEL5 Linux) so that I can have multiple domains on the same server on the same port but in different subdirectories?

如何通过webmin或命令行配置Apache2(我使用的是RHEL5 Linux),以便在同一端口上但在不同子目录中的同一服务器上可以有多个域?

For instance, trying to get homerentals.ws and homerepair.ws to be detected on port 80 (default port) on the same server. I know that my DNS holds the two addresses and web hits currently go to the same test page. Now all I need is for web hits to go to a subdirectory, but not show this subdirectory. For instance, I do not want people going to http://homerentals.ws and being redirected back to http://homerentals.ws/homerentals/. Instead, http://homerentals.ws would go to /var/www/html/homerentals, while http://homerepair.ws would go to var/www/html/homerepair, but would not look any differently in the URL.

例如,尝试在同一服务器上的端口80(默认端口)上检测homerentals.ws和homerepair.ws。我知道我的DNS拥有两个地址,网页点击目前转到同一个测试页面。现在我需要的是网页命中转到子目录,但不显示此子目录。例如,我不希望人们访问http://homerentals.ws并被重定向回http://homerentals.ws/homerentals/。相反,http://homerentals.ws将转至/ var / www / html / homerentals,而http://homerepair.ws将转至var / www / html / homerepair,但在URL中看起来不会有任何不同。

On IIS, I did this once with host-header detection. But I don't know how to do it on RHEL5 Linux via webmin or file editing. I'm stuck.

在IIS上,我做了一次主机头检测。但我不知道如何通过webmin或文件编辑在RHEL5 Linux上执行此操作。我被卡住了。

1 个解决方案

#1


The feature you're describing is known as virtual hosts. Have a look at Apache's documentation. In general you need to edit /etc/apache2/httpd.conf file to make things happen (maybe it can be edited through webmin, but I'm not familiar with it).

您描述的功能称为虚拟主机。看看Apache的文档。通常,您需要编辑/etc/apache2/httpd.conf文件以使事情发生(也许它可以通过webmin编辑,但我不熟悉它)。

#1


The feature you're describing is known as virtual hosts. Have a look at Apache's documentation. In general you need to edit /etc/apache2/httpd.conf file to make things happen (maybe it can be edited through webmin, but I'm not familiar with it).

您描述的功能称为虚拟主机。看看Apache的文档。通常,您需要编辑/etc/apache2/httpd.conf文件以使事情发生(也许它可以通过webmin编辑,但我不熟悉它)。