我正在玩一个流浪汉的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
中添加此属性?
答案 0 :(得分:1)
当您的服务器不知道自己的完全限定域名时,通常会导致此错误...尝试使用vagrant命令hostname进行设置:
config.vm.hostname = "server.name"
有关详情,请参阅此页:http://docs.vagrantup.com/v2/vagrantfile/machine_settings.html