如何为wamp中的不同虚拟主机分配不同的(真实的)域名
How to assign different ( real ) domains names to different virtual hosts in wamp
我有5个真实域名和5个不同的设置虚拟主机我想知道如何将域名连接到我的虚拟主机
我是新手,所以请回答简单易懂的答案
感谢阅读并希望回答
如果我正确理解了您的 2 类似问题,您已经设置了 5 个虚拟主机用于测试目的。
所以假设您有 example1.dev
和 example2.dev
... 等设置为像这样的虚拟主机
<VirtualHost *:80>
DocumentRoot "C:/wamp/example1/www"
ServerName example1.dev
ServerAlias www.example1.dev
Options Indexes FollowSymLinks
<Directory "C:/wamp/example1/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp/example2/www"
ServerName example2.dev
ServerAlias www.example2.dev
Options Indexes FollowSymLinks
<Directory "C:/wamp/example2/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
现在,如果您希望 Apache 为您的 .tk
域提供服务,您需要为每个新域设置一个新的虚拟主机。我个人建议您将这些站点放在不同的文件夹中,这样您仍然可以拥有测试域和实际域。因此,使用 example1.tk
和 example2.tk
您将为每个域创建一个新的虚拟主机。
首先将每个域复制到一个新文件夹,最好是一个根本不在 \wamp\
目录结构中的文件夹。比方说 C:\websrc
。然后像这样在测试域之外创建新的虚拟主机:-
<VirtualHost *:80>
DocumentRoot "C:/websrc/example1/www"
ServerName example1.tk
ServerAlias www.example1.tk
Options Indexes FollowSymLinks
<Directory "C:/websrc/example1/www">
AllowOverride All
Require all granted <- to allow inet access
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/websrc/example2/www"
ServerName example2.tk
ServerAlias www.example2.tk
Options Indexes FollowSymLinks
<Directory "C:/websrc/example2/www">
AllowOverride All
Require all granted <- to allow inet access
</Directory>
</VirtualHost>
现在 Apache 知道在看到您的 .tk
域时要提供什么服务。
我有5个真实域名和5个不同的设置虚拟主机我想知道如何将域名连接到我的虚拟主机 我是新手,所以请回答简单易懂的答案 感谢阅读并希望回答
如果我正确理解了您的 2 类似问题,您已经设置了 5 个虚拟主机用于测试目的。
所以假设您有 example1.dev
和 example2.dev
... 等设置为像这样的虚拟主机
<VirtualHost *:80>
DocumentRoot "C:/wamp/example1/www"
ServerName example1.dev
ServerAlias www.example1.dev
Options Indexes FollowSymLinks
<Directory "C:/wamp/example1/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp/example2/www"
ServerName example2.dev
ServerAlias www.example2.dev
Options Indexes FollowSymLinks
<Directory "C:/wamp/example2/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
现在,如果您希望 Apache 为您的 .tk
域提供服务,您需要为每个新域设置一个新的虚拟主机。我个人建议您将这些站点放在不同的文件夹中,这样您仍然可以拥有测试域和实际域。因此,使用 example1.tk
和 example2.tk
您将为每个域创建一个新的虚拟主机。
首先将每个域复制到一个新文件夹,最好是一个根本不在 \wamp\
目录结构中的文件夹。比方说 C:\websrc
。然后像这样在测试域之外创建新的虚拟主机:-
<VirtualHost *:80>
DocumentRoot "C:/websrc/example1/www"
ServerName example1.tk
ServerAlias www.example1.tk
Options Indexes FollowSymLinks
<Directory "C:/websrc/example1/www">
AllowOverride All
Require all granted <- to allow inet access
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/websrc/example2/www"
ServerName example2.tk
ServerAlias www.example2.tk
Options Indexes FollowSymLinks
<Directory "C:/websrc/example2/www">
AllowOverride All
Require all granted <- to allow inet access
</Directory>
</VirtualHost>
现在 Apache 知道在看到您的 .tk
域时要提供什么服务。