0

我正在玩一个流浪的 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

4

1 回答 1

1

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

config.vm.hostname = "server.name"

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

于 2013-05-17T22:00:21.703 回答