0

我正在尝试使用为 CakePHP 2.x 项目提供 PHP 5.6.x、Apache 2.4、MySQL 5.x 的默认包在 Ubuntu 15.04 上创建 LAMP 堆栈,但我在配置 Apache 时遇到问题,它似乎没有正确启动,尽管它已安装。我无法点击在配置脚本底部添加的测试 index.html,或者指向公共目录 /var/www/app/webroot 的虚拟主机。

所有组件似乎都已正确安装,因为我可以检查它们的所有版本,但是我在 Apache 上配置错误或错过了配置?我真的不想再次安装 XAMPP,因为去年使用了 Laravel Homestead。流浪盒子是最好的方法。

我用我的 Vagrantfile、Lamp.rb 和 provision.sh 脚本创建了一个GIST ,它们的路径位于顶部。任何人都可以启动它,看看我做错了什么。

终端中的 Vagrant Up 错误

==> default: Job for apache2.service failed. See "systemctl status 
    apache2.service" and "journalctl -xe" for details.

当我尝试重新启动 apache 时,我会遇到与第一次运行时相同的错误vagrant up

root@test:/# sudo service apache2 restart
Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.

来自 var/log/apache2/error.log 的错误日志

我无法访问 error.log 并且得到了这个-bash: cd: var/log/apache2: Permission denied。所以我不得不使用sudo su,这似乎工作,但我不想每次都这样做,所以如果有人知道需要做什么来提供用户许可,我会很感激。我发现的关于这个的帖子似乎并没有真正解释我需要做什么才能正确地做到这一点sudo su。从那里我可以使用 nano 访问错误日志。

[Sat Jan 02 19:03:54.589161 2016] [mpm_event:notice] [pid 3529:tid 140703238530944] AH00489: Apache/2.4.10 (Ubuntu) co$
[Sat Jan 02 19:03:54.589263 2016] [core:notice] [pid 3529:tid 140703238530944] AH00094: Command line: '/usr/sbin/apach$
[Sat Jan 02 19:03:58.874664 2016] [mpm_event:notice] [pid 3529:tid 140703238530944] AH00491: caught SIGTERM, shutting $
[Sat Jan 02 19:03:59.950199 2016] [mpm_prefork:notice] [pid 4803] AH00163: Apache/2.4.10 (Ubuntu) configured -- resumi$
[Sat Jan 02 19:03:59.950314 2016] [core:notice] [pid 4803] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 02 19:04:01.359328 2016] [mpm_prefork:notice] [pid 4803] AH00169: caught SIGTERM, shutting down
[Sat Jan 02 19:04:02.467409 2016] [mpm_prefork:notice] [pid 4906] AH00163: Apache/2.4.10 (Ubuntu) configured -- resumi$
[Sat Jan 02 19:04:02.467483 2016] [core:notice] [pid 4906] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 02 19:05:16.040251 2016] [mpm_prefork:notice] [pid 4906] AH00169: caught SIGTERM, shutting down
4

1 回答 1

1

问题是因为一些配置文件被删除了,你必须重新安装它。

重新安装 Apache2:

要替换已删除的配置文件,而不清除包,您可以这样做

sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2

要完全删除 apache2 配置文件,您应该

sudo apt-get purge apache2

然后让您以通常的方式重新安装它

sudo apt-get install apache2

需要清除以删除所有配置文件 - 如果您删除配置文件但仅删除软件包,则会记住这一点并且默认情况下不会重新安装丢失的配置文件。

然后重新安装 PHP5:

apt-get purge libapache2-mod-php5 php5 && \ apt-get install libapache2-mod-php5 php5

于 2016-03-15T09:35:08.773 回答