Zac*_*tes 7 startup httpd centos vagrant
我在配置 CentOS 6 Vagrant 设置以在启动时启动 Apache 服务时遇到问题。我曾尝试使用 chkconfig 并且操作系统似乎只是忽略它。
当我跑步时sudo chkconfig --list httpd
,我得到
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Run Code Online (Sandbox Code Playgroud)
我认为这是运行命令的结果
sudo chkconfig httpd on
sudo chkconfig --levels 235 httpd on
sudo chkconfig --levels 345 httpd on
Run Code Online (Sandbox Code Playgroud)
在我的配置脚本中正确配置这个东西的不同尝试。我没有使用 Puppet 或 Chef,我也真的不想使用。我在另一台主机上运行了这个,但在第二台主机上它似乎由于某种原因停止工作。
手动启动服务sudo service httpd start
工作正常,但只要我这样做,vagrant halt && vagrant up
或者vagrant reload
当虚拟机恢复时服务将不会启动。
令人沮丧的是,我以完全相同的方式配置的 mysqld 服务在启动时完全正常。
我的 /var/log/httpd/error_log 是这样说的:
[Thu Apr 17 09:31:09 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Apr 17 09:31:09 2014] [notice] Digest: generating secret for digest authentication ...
[Thu Apr 17 09:31:09 2014] [notice] Digest: done
[Thu Apr 17 09:31:09 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.5.11 configured -- resuming normal operations
[Thu Apr 17 09:34:45 2014] [notice] caught SIGTERM, shutting down
Run Code Online (Sandbox Code Playgroud)
问题原来是虚拟机在 Vagrant 挂载共享文件夹之前尝试启动 Apache 服务,并且 httpd DocumentRoot 指向一个不存在的目录。我按照这些说明设置了一个 udev 事件,等待安装发生后再尝试启动 httpd。
http://razius.com/articles/launching-services-after-vagrant-mount/
归档时间: |
|
查看次数: |
5257 次 |
最近记录: |