2016-01-01 48 views
0

我尝试使用apache cookbook中的以下代码将默认端口80映射到443,但是我仍然在运行厨师时遇到错误。你能否就此提出建议。我试图映射到除端口#80,因为我有nginx的配方也是在我的食谱所以想设立的Apache2监听DIFF端口等 -如何在apache2 cookbook中转发端口

* apache/attribute/default.rb 

default['apache']['dir']   = '/etc/apache2' 
default['apache']['listen_ports'] = [ '80','443' ] 

* apache/recipes/default.rb 

package "apache2" do 
    action :install 
end 

service "apache2" do 
    action [:enable, :start] 
end 


template "/var/www/index.html" do 
    source "index.html.erb" 
    mode "0644" 
end 

Vagrant provision error - 
    ================================================================================ 
    ==> default:  
    ==> default: Error executing action `start` on resource 'service[apache2]' 
    ==> default:  
================================================================================ 

    ==> default:  
    ==> default: Mixlib::ShellOut::ShellCommandFailed 
    ==> default:  
    ==> default: ------------------------------------ 
    ==> default:  
    ==> default: Expected process to exit with [0], but received '1' 


This time I had used ==> 
attribute/default.rb with below content but still getting error - 
default['apache']['dir']   = '/etc/apache2' 
default['apache']['listen_ports'] = [ '81’ ] 

Error  
==> default: STDOUT: * Starting web server apache2 
==> default: 
==> default:  Action 'start' failed. 
==> default:  The Apache error log may have more information. 
==> default:  ...fail! 
==> default:  STDERR: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName 
==> default:  (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 

回答

0

listen_ports不是一个映射,它设置端口听着。如果你不想听80,不要把它包括在该阵列中。

+0

请将日志内容添加到问题中,它会在此处重新格式化为一行。 – coderanger

+0

做了更改后得到了一个diff错误,并在上面的问题中添加了错误消息。 – raj

+0

新的错误是说有东西已经在该端口(80)上侦听,所以某处的端口80仍在使用中。 – Martin