How i can add “ServerName xxx” in httpd.conf through chef in centos

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How i can add “ServerName xxx” in httpd.conf through chef in centos

Alessandro Pelliciari

Hi, i'm playing with a vagrant Centos 6.4 box,

here's the relevant part of my 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

Unfortunately when i do vagrant provision i get some errors because apache doesn't start properly. The error is httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

If i do vagrant ssh then i can fix it adding ServerName localhost to the httpd.conf (/var/httpd/conf/httpd.conf) and httpd service starts properly.

How can I add this as attribute in chef.json?

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How i can add “ServerName xxx” in httpd.conf through chef in centos

Mike
A) This is probably not a Vagrant issue, rather a Chef issue, and
you're probably going to get better help over on a Chef mailing
list/IRC.

B) The default site for Apache is probably enabled, and your custom
site is not being loaded.

To address this, I typically create the following stanza in my
cookbook, something in your run list such as "my":

web_app "my_site" do
  server_name node['hostname']
  server_aliases [node['fqdn'], "my-site.example.com"]
  docroot "/srv/www/my_site"
end

This will generate a /etc/apache2/sites-available/my_site.conf (and
link to sites-enabled/).

To disable the default site, set
`node['apache']['default_site_enabled']` to false, either in Vagrant,
or in your `my` cookbook.

-M

On Fri, May 17, 2013 at 11:46 AM, Alessandro Pelliciari
<[hidden email]> wrote:

> Hi, i'm playing with a vagrant Centos 6.4 box,
>
> here's the relevant part of my 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
>
> Unfortunately when i do vagrant provision i get some errors because apache
> doesn't start properly. The error is httpd: Could not reliably determine the
> server's fully qualified domain name, using localhost.localdomain for
> ServerName
>
> If i do vagrant ssh then i can fix it adding ServerName localhost to the
> httpd.conf (/var/httpd/conf/httpd.conf) and httpd service starts properly.
>
> How can I add this as attribute in chef.json?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.