gpt4 book ai didi

使用 Puppet 安装后 Apache 无法启动

转载 作者:行者123 更新时间:2023-12-04 19:44:57 27 4
gpt4 key购买 nike

我已经通过 puppetlabs/apache 安装了 Apache,但它不会启动。我抛出错误 Address already in use: AH00072: make_sock: could not bind to address无论使用什么端口。 netstat -lntp使用该端口不显示任何内容。我的系统是 CentOS 7,我正在使用来自 centos-sclo-rh 的软件包 repo 。以下是我安装的与此相关的软件包:

$ rpm -qa |grep 'http\|php' |sort
httpd24-1.1-9.el7.x86_64
httpd24-httpd-2.4.12-6.el7.1.x86_64
httpd24-httpd-devel-2.4.12-6.el7.1.x86_64
httpd24-httpd-tools-2.4.12-6.el7.1.x86_64
httpd24-mod_ssl-2.4.12-6.el7.1.x86_64
httpd24-runtime-1.1-9.el7.x86_64
rh-php56-2.0-6.el7.x86_64
rh-php56-php-cli-5.6.5-7.el7.x86_64
rh-php56-php-common-5.6.5-7.el7.x86_64
rh-php56-php-pear-1.9.5-3.el7.noarch
rh-php56-php-pecl-jsonc-1.3.6-3.el7.x86_64
rh-php56-php-process-5.6.5-7.el7.x86_64
rh-php56-php-xml-5.6.5-7.el7.x86_64
rh-php56-runtime-2.0-6.el7.x86_64

这是我的 Puppet list 。任何帮助将不胜感激。
exec { 'create localhost cert':
# lint:ignore:80chars
command => "/bin/openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -sha256 -subj '/CN=domain.com/O=My Company Name LTD./C=US' -keyout /etc/pki/tls/private/localhost.key -out /etc/pki/tls/certs/localhost.crt",
# lint:endignore
creates => '/etc/pki/tls/certs/localhost.crt',
logoutput => true,
before => Class['apache'],
}

package { 'centos-release-scl-rh':
ensure => installed,
}

$packages = [
'httpd24',
'rh-php56',
'scl-utils',
]

package { $packages:
ensure => installed,
before => Class['apache'],
require => Package['centos-release-scl-rh'],
}

user { 'webmaster':
ensure => present,
before => Class['apache'],
}

$scl_httpd = '/opt/rh/httpd24/root'

class { 'apache':
apache_name => 'httpd24-httpd',
apache_version => '2.4',
conf_dir => "${scl_httpd}/etc/httpd/conf",
confd_dir => "${scl_httpd}/etc/httpd/conf.d",
default_mods => false,
default_ssl_vhost => false,
default_vhost => false,
dev_packages => 'httpd24-httpd-devel',
docroot => "${scl_httpd}/var/www/html",
httpd_dir => "${scl_httpd}/etc/httpd",
logroot => '/var/log/httpd24',
mod_dir => "${scl_httpd}/etc/httpd/conf.modules.d",
mpm_module => 'worker',
pidfile => '/opt/rh/httpd24/root/var/run/httpd/httpd.pid',
ports_file => "${scl_httpd}/etc/httpd/conf.d/ports.conf",
purge_configs => true,
serveradmin => 'root@localhost',
servername => 'demobox.example.com',
server_root => "${scl_httpd}/etc/httpd",
service_name => 'httpd24-httpd',
trace_enable => false,
vhost_dir => "${scl_httpd}/etc/httpd/conf.d",
vhost_include_pattern => '*.conf',
}

class { 'apache::dev': }

class { 'apache::mod::ssl':
package_name => 'httpd24-mod_ssl',
}

apache::vhost { 'main-site-nonssl':
ip => '*',
ip_based => true,
port => '80',
docroot => "${scl_httpd}/var/www/main-site",
# docroot_owner => 'webmaster',
# docroot_group => 'webmaster',
}

apache::vhost { 'main-site-ssl':
ip => '*',
ip_based => true,
port => '443',
docroot => "${scl_httpd}/var/www/main-site",
# docroot_owner => 'webmaster',
# docroot_group => 'webmaster',
ssl => true,
ssl_cert => '/etc/pki/tls/certs/localhost.crt',
ssl_key => '/etc/pki/tls/private/localhost.key',
}

最佳答案

原来我放了​​ports.confconf.d而不是 conf这意味着它被包含两次。更改 ports_file => "${scl_httpd}/etc/httpd/conf.d/ports.conf",ports_file => "${scl_httpd}/etc/httpd/conf/ports.conf",解决了这个问题。

关于使用 Puppet 安装后 Apache 无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34378198/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com