如何在open suse中使用yast设置基于名称的虚拟主机?

时间:2013-09-11 13:31:36

标签: apache virtualhost opensuse

我试图在open suse下设置虚拟主机。我在Yast-> Http服务器,当我检查“通过HTTP标头确定请求服务器”时收到错误消息To use name-based virtual you must designate the ip adress on the server(...) 我做了一些谷歌搜索,并根据我发现我取消了NameVirtualHost *:80 /etc/apache2/listen.conf行{{1}}行并重新启动apache但它没有帮助。我怎样才能正确设置它(也许我应该通过yast而不需要手动编辑conf文件,但我找不到该选项)

2 个答案:

答案 0 :(得分:0)

我遇到的问题是因为我在NameVirtualHost *:80中有listen.conf而在ServerName中有example.com:80,但它们必须完全相同。

当我设置NameVirtualHost example.com:80然后尝试使用ServerName example.com添加服务器时,它仍然没有按预期工作我仍然会收到错误消息。当然,我的hosts文件中的example.com指向127.0.0.1

答案 1 :(得分:0)

相当过时的问题,但万一有人遇到它:

1)我添加了

NameVirtualHost my_virtual_hostname_here.tld:80

<VirtualHost ...部分之前

2)改变了 <VirtualHost *:80><VirtualHost my_virtual_hostname_here.tld>

这对我有用。当然如上所述@Lord_JABA不要忘记将127.0.0.1 my_virtual_hostname_here.tld添加到/ etc / hosts