0

I installed apache, and then needed to reinstall due to file loss. Now I get this error when trying to install.

Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu xenial-updates/main amd64 
apache2 amd64 2.4.18-2ubuntu3.2 [86.7 kB]
Fetched 86.7 kB in 0s (219 kB/s)
Selecting previously unselected package apache2.
(Reading database ... 93244 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.18-2ubuntu3.2_amd64.deb ...
Unpacking apache2 (2.4.18-2ubuntu3.2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu17) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Setting up apache2 (2.4.18-2ubuntu3.2) ...
Job for apache2.service failed because the control process exited with error 
code. See "systemctl status apache2.service" and "journalctl -xe" for 
details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
      Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Fri 2017-05-12 14:39:57 EDT; 6ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13282 ExecStart=/etc/init.d/apache2 start (code=exited, 
status=1/FAILURE)

May 12 14:39:57 vps128760 apache2[13282]:  * The apache2 configtest failed.
May 12 14:39:57 vps128760 apache2[13282]: Output of config test was:
May 12 14:39:57 vps128760 apache2[13282]: (2)No such file or directory: AH02...1
May 12 14:39:57 vps128760 apache2[13282]: AH00014: Configuration check failed
May 12 14:39:57 vps128760 apache2[13282]: Action 'configtest' failed.
May 12 14:39:57 vps128760 apache2[13282]: The Apache error log may have more....
May 12 14:39:57 vps128760 systemd[1]: apache2.service: Control process exit...=1
May 12 14:39:57 vps128760 systemd[1]: Failed to start LSB: Apache2 web server.
May 12 14:39:57 vps128760 systemd[1]: apache2.service: Unit entered failed ...e.
May 12 14:39:57 vps128760 systemd[1]: apache2.service: Failed with result '...'.
Hint: Some lines were ellipsized, use -l to show in full.

Config file:

 <VirtualHost *:80> 
      ServerAdmin [email protected] 
      ServerName ex.com 
      ServerAlias www.ex.com 
      DocumentRoot /var/www/html/ 
      ErrorLog /var/www/html/logs/error.log 
      CustomLog /var/www/html/logs/access.log combined 

Result: apache2ctl configtest

 ● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2017-05-12 14:39:57 EDT; 
49min 
    ago
     Docs: man:systemd-sysv-generator(8)

May 12 14:39:57 vps128760 apache2[13282]: Output of config test was:
May 12 14:39:57 vps128760 apache2[13282]: (2)No such file or directory: 
AH02291: 
Cannot access directory '/var/www/html/logs/' for error log of vhost defined 
at 
/etc/apache2/sites-enabled/ex.conf:1
May 12 14:39:57 vps128760 apache2[13282]: AH00014: Configuration check 
failed
May 12 14:39:57 vps128760 apache2[13282]: Action 'configtest' failed.
May 12 14:39:57 vps128760 apache2[13282]: The Apache error log may have more 
information.
May 12 14:39:57 vps128760 systemd[1]: apache2.service: Control process 
exited, 
code=exited status=1
May 12 14:39:57 vps128760 systemd[1]: Failed to start LSB: Apache2 web 
server.
May 12 14:39:57 vps128760 systemd[1]: apache2.service: Unit entered failed 
state.
May 12 14:39:57 vps128760 systemd[1]: apache2.service: Failed with result 
'exit-code'.
May 12 15:26:29 vps128760 systemd[1]: Stopped LSB: Apache2 web server.

root@vps128760:~# sudo apt install apache2

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages were automatically installed and are no longer 
    required:
      linux-headers-4.4.0-62 linux-headers-4.4.0-62-generic linux-image-4.4.0-
    62-generic
    Use 'sudo apt autoremove' to remove them.
    Suggested packages:
      www-browser
    The following NEW packages will be installed:
      apache2
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/86.7 kB of archives.
    After this operation, 501 kB of additional disk space will be used.
    Selecting previously unselected package apache2.
    (Reading database ... 121166 files and directories currently installed.)
    Preparing to unpack .../apache2_2.4.18-2ubuntu3.2_amd64.deb ...
   Unpacking apache2 (2.4.18-2ubuntu3.2) ...
    Processing triggers for man-db (2.7.5-1) ...
    Processing triggers for systemd (229-4ubuntu17) ...
    Processing triggers for ureadahead (0.100.0-19) ...
    Processing triggers for ufw (0.35-0ubuntu2) ...
    Setting up apache2 (2.4.18-2ubuntu3.2) ...
    Job for apache2.service failed because the control process exited with error 
    code. See "systemctl status apache2.service" and "journalctl -xe" for 
    details.
    invoke-rc.d: initscript apache2, action "start" failed.
    ● apache2.service - LSB: Apache2 web server
       Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
      Drop-In: /lib/systemd/system/apache2.service.d
               └─apache2-systemd.conf
      Active: failed (Result: exit-code) since Fri 2017-05-12 15:53:05 EDT; 6ms 
    ago
         Docs: man:systemd-sysv-generator(8)
      Process: 20926 ExecStart=/etc/init.d/apache2 start (code=exited, 
    status=1/FAILURE)

    May 12 15:53:05 vps128760 apache2[20926]:  * The apache2 configtest failed.
    May 12 15:53:05 vps128760 apache2[20926]: Output of config test was:
    May 12 15:53:05 vps128760 apache2[20926]: (2)No such file or directory: 
    AH02291: Cannot access directory '/var/www/html/logs/' for error log of 
    vhost defined at /etc/apache2/sites-enabled/example.com.conf:1
    May 12 15:53:05 vps128760 apache2[20926]: AH00014: Configuration check 
    failed
    May 12 15:53:05 vps128760 apache2[20926]: Action 'configtest' failed.
    May 12 15:53:05 vps128760 apache2[20926]: The Apache error log may have more 
    information.
    May 12 15:53:05 vps128760 systemd[1]: apache2.service: Control process 
    exited, code=exited status=1
    May 12 15:53:05 vps128760 systemd[1]: Failed to start LSB: Apache2 web 
    server.
    May 12 15:53:05 vps128760 systemd[1]: apache2.service: Unit entered failed 
    state.
    May 12 15:53:05 vps128760 systemd[1]: apache2.service: Failed with result 
    'exit-code'.

Result of sudo journalctl -u apache2:

-- Logs begin at Thu 2017-05-11 13:14:52 EDT, end at Fri 2017-05-12 16:25:27 EDT
    May 11 13:14:57 vps128760 systemd[1]: Starting LSB: Apache2 web server...
    May 11 13:14:57 vps128760 apache2[1055]:  * Starting Apache httpd web server 
    apa
    May 11 13:14:58 vps128760 apache2[1055]:  *
    May 11 13:14:58 vps128760 apache2[1055]:  * The apache2 configtest failed.
    May 11 13:14:58 vps128760 apache2[1055]: Output of config test was:
    May 11 13:14:58 vps128760 apache2[1055]: (2)No such file or directory: 
    AH02291:
    May 11 13:14:58 vps128760 apache2[1055]: AH00014: Configuration check failed
    May 11 13:14:58 vps128760 apache2[1055]: Action 'configtest' failed.
    May 11 13:14:58 vps128760 apache2[1055]: The Apache error log may have more 
    info
    May 11 13:14:58 vps128760 systemd[1]: apache2.service: Control process 
    exited, c
    May 11 13:14:58 vps128760 systemd[1]: Failed to start LSB: Apache2 web 
    server.
    May 11 13:14:58 vps128760 systemd[1]: apache2.service: Unit entered failed 
    state
May 11 13:14:58 vps128760 systemd[1]: apache2.service: Failed with result 'exit-
May 12 14:32:12 vps128760 systemd[1]: Stopped LSB: Apache2 web server.
May 12 14:32:12 vps128760 systemd[1]: Starting LSB: Apache2 web server...
May 12 14:32:12 vps128760 apache2[9941]:  * Starting Apache httpd web server apa
May 12 14:32:12 vps128760 apache2[9941]:  *
May 12 14:32:12 vps128760 apache2[9941]:  * The apache2 configtest failed.
May 12 14:32:12 vps128760 apache2[9941]: Output of config test was:
May 12 14:32:12 vps128760 apache2[9941]: (2)No such file or directory: AH02291:
May 12 14:32:12 vps128760 apache2[9941]: AH00014: Configuration check failed
May 12 14:32:12 vps128760 apache2[9941]: Action 'configtest' failed.

Results of ls /etc/apache2/sites-available:

000-default.conf  default-ssl.conf ex.com.conf
0

1 Answer 1

1

Your version of the config file:

<VirtualHost *:80> 
          ServerAdmin [email protected] 
          ServerName example.com 
          ServerAlias www.example.com 
          DocumentRoot /var/www/html/ 
          ErrorLog /var/www/html/logs/error.log 
          CustomLog /var/www/html/logs/access.log combined 

The right version:

<VirtualHost *:80> 
          ServerAdmin [email protected] 
          ServerName example.com 
          ServerAlias www.example.com 
          DocumentRoot /var/www/html/ 
          ErrorLog /var/www/html/logs/error.log 
          CustomLog /var/www/html/logs/access.log combined
</VirtualHost>

My own from one of my config file:

<VirtualHost *:80>

    ServerName edu.app
    DocumentRoot /var/www/html/edu-test/public/
    DirectoryIndex index.php

    <Directory />
         Options FollowSymLinks
         AllowOverride None
    </Directory>

    <Directory /var/www/html/edu-test>
        AllowOverride All
        Require all granted
    </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Thomas Ward
    May 12, 2017 at 21:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .