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
請將日誌內容添加到問題中,它會在此處重新格式化爲一行。 – coderanger
做了更改後得到了一個diff錯誤,並在上面的問題中添加了錯誤消息。 – raj
新的錯誤是說有東西已經在該端口(80)上偵聽,所以某處的端口80仍在使用中。 – Martin