0

I'm trying to create a LAMP stack on Ubuntu 15.04 using the default packages providing PHP 5.6.x, Apache 2.4, MySQL 5.x for a CakePHP 2.x project, and I'm having issues configuring Apache it doesn't seem to start up properly, though it is installed. I can't hit the test index.html I added at the bottom of the provisioning script, or the vhost pointed at the public directory /var/www/app/webroot.

All the components appear to be installed properly as I can check all their versions, but I've misconfigured or missed configuration on Apache? I really don't want to install XAMPP again having used Laravel Homestead for the last year. A vagrant box is the best way to go.

I created a GIST with my Vagrantfile, Lamp.rb, and provision.sh script with their paths at the top. Can anyone boot this up and see what I've done wrong.

Vagrant Up Error In Terminal

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

When I try to restart apache I get the same error you see when first running vagrant up:

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

Error Log From var/log/apache2/error.log

I couldn't get access to the error.log and was getting this -bash: cd: var/log/apache2: Permission denied. So I had to use sudo su, which seemed to work, but I don't want to do this each time so if anyone knows what needs to be done to provide user permission I'd appreciate it. The posts I've found concerning this don't seem to really explain what I need to do this correctly only that sudo su will work. From there I was able to get access to the error log using 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
mtpultz
  • 13,197
  • 18
  • 96
  • 180

1 Answers1

1

The problem is because some configuration files are deleted, you have to reinstall it.

REINSTALL APACHE2:

To replace configuration files that have been deleted, without purging the package,you can do

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

To fully remove the apache2 config files, you should

sudo apt-get purge apache2

which will then let you reinstall it in the usual way with

sudo apt-get install apache2

Purge is required to remove all the config files - if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.

Then REINSTALL PHP5:

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

Rujika Rajan
  • 181
  • 1
  • 7