虚拟主机无法正常工作

发布于 2024-12-01 07:06:43 字数 1051 浏览 0 评论 0原文

我设置了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暗藏城府 2024-12-08 07:06:43

我不确定,但这可能与您的防火墙有关。我个人从未使用过 80 以外的任何端口。除非您有特定需要,要求您使用不同的端口,否则我建议您仅使用端口 80 或 8080。您的所有虚拟主机都使用相同的端口,您只需使用不同的服务器名称。还要确保在您的 etchosts 文件中添加:

127.0.0.1    servername.com

其中 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:

127.0.0.1    servername.com

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文