gpt4 book ai didi

apache - 我如何通过 Chef/vagrant 在 httpd.conf 中添加 "ServerName xxx"

转载 作者:行者123 更新时间:2023-12-04 19:38:43 26 4
gpt4 key购买 nike

我正在玩一个 Vagrant 的 Centos 6.4 盒子,

这是我的 Vagrantfile 的相关部分

  config.vm.provision :chef_solo do |chef|
chef.json = {
"apache" => {
"listen_address" => "0.0.0.0",
"server_name" => "localhost", # ?? this doesn't work
},
}
chef.add_recipe "yum"
chef.add_recipe "selinux::disabled"
chef.add_recipe "vim"
# chef.add_recipe "openssl"
chef.add_recipe "apache2"
chef.add_recipe "php"
chef.add_recipe "php::module_curl"
chef.add_recipe "php::module_mysql"
chef.add_recipe "apache2::mod_php5"
chef.add_recipe "apache2::mod_rewrite"
chef.add_recipe "my"
end

不幸的是,当我这样做时 vagrant provision我收到一些错误,因为 apache 无法正常启动。错误是 httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
如果我这样做 vagrant ssh然后我可以修复它添加 ServerName localhost到 httpd.conf (/var/httpd/conf/httpd.conf) 和 httpd 服务正常启动。

如何在 chef.json 中将其添加为属性?

最佳答案

当您的服务器不知道自己的完全限定域名时,通常会导致此错误...尝试使用 vagrant 命令主机名进行设置:

config.vm.hostname = "server.name"

有关详细信息,请参阅此页面: http://docs.vagrantup.com/v2/vagrantfile/machine_settings.html

关于apache - 我如何通过 Chef/vagrant 在 httpd.conf 中添加 "ServerName xxx",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16611924/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com