我尝试使用apache cookbook中的以下代码将默认端口80映射到443但是在运行厨师时仍然出现错误。你能就此提出建议吗?我尝试映射到#80以外的端口,因为我的食谱中也有nginx配方,所以想设置apache2来监听diff端口 -
* 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 :(得分:0)
listen_ports
不是映射,它设置要侦听的端口。如果您不想听80,请不要将其包含在该阵列中。