虚拟主机无法正常工作
我设置了 2 个虚拟主机:
httpd-vhosts.conf
NameVirtualHost *:81
NameVirtualHost *:82
....
<VirtualHost *:81>
ServerName krmsrv05
# ServerAlias krmsrv05
DocumentRoot "C:/xampp/htdocs"
# ServerAdmin postmaster@krmsrv05
# ErrorLog "logs/localhost-error.log"
# CustomLog "logs/localhost-access.log" combined
</VirtualHost>
<VirtualHost *:82>
ServerName krmsrv05
# ServerAlias pprod.krmsrv05
DocumentRoot "C:/xampp/htdocs/portail_zf"
# SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/portail_zf">
DirectoryIndex index.php
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
httpd.conf
Listen 81
Listen 82
...
ServerName krmsrv05
我的问题是第二个 Vhost(端口 82)可以工作,但第一个不行:(
apache 没有给出错误消息(...)
我需要你的帮助
非常感谢:)
(抱歉我的英语不好)
i set up 2 virual hosts:
httpd-vhosts.conf
NameVirtualHost *:81
NameVirtualHost *:82
....
<VirtualHost *:81>
ServerName krmsrv05
# ServerAlias krmsrv05
DocumentRoot "C:/xampp/htdocs"
# ServerAdmin postmaster@krmsrv05
# ErrorLog "logs/localhost-error.log"
# CustomLog "logs/localhost-access.log" combined
</VirtualHost>
<VirtualHost *:82>
ServerName krmsrv05
# ServerAlias pprod.krmsrv05
DocumentRoot "C:/xampp/htdocs/portail_zf"
# SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/portail_zf">
DirectoryIndex index.php
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
httpd.conf
Listen 81
Listen 82
...
ServerName krmsrv05
my problem is the second Vhost(port 82) works but the first one no :(
no error messages given by apache (...)
i need your help
many thanx :)
(sorry for my bad english)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定,但这可能与您的防火墙有关。我个人从未使用过 80 以外的任何端口。除非您有特定需要,要求您使用不同的端口,否则我建议您仅使用端口 80 或 8080。您的所有虚拟主机都使用相同的端口,您只需使用不同的服务器名称。还要确保在您的 etchosts 文件中添加:
其中 servername.com 是您在 vhost 文件中的 ServerName 旁边放置的内容。我建议在服务器名末尾使用 .com,否则我发现浏览器会像您尝试搜索 google 一样处理您的 url 请求。
我希望这有帮助。如果我不明白你的问题或者我没有说清楚,请告诉我:)干杯!
I'm not sure but it may have something to do with your firewall. I've never personally used anything other that 80. Unless you have a specific need that requires you to use different ports I would recommend you only use port 80 or 8080. You have all of your virtual hosts using the same port you just have to use a different ServerName. Also make sure in your etc hosts file you add:
Where servername.com is what you put next to ServerName in your vhost file. I recommend using a .com at the end of the servername otherwise I've found that browsers will treat your url request as if you're trying to search google.
I hope that helps. Let me know if I didn't understand your question or I didn't make myself clear :) Cheers!