0

I have a CentOS 7 VPS where I am trying to install virtual host following the instruction from https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7.

I have completed step five of this tutorial. Then when I try to restart apache I failed:

$ sudo apachectl restart
[sudo] password for student01: 
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
$ sudo systemctl status httpd.service -l
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since বুধ 2018-04-11 14:29:55 +06; 4min 13s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 11116 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 11115 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 11115 (code=exited, status=1/FAILURE)

এপ্রি 11 14:29:55 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
এপ্রি 11 14:29:55 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
এপ্রি 11 14:29:55 localhost.localdomain kill[11116]: kill: cannot find process ""
এপ্রি 11 14:29:55 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
এপ্রি 11 14:29:55 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
এপ্রি 11 14:29:55 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
এপ্রি 11 14:29:55 localhost.localdomain systemd[1]: httpd.service failed.

Now, What can I do?

Edit
/var/log/httpd/error_log

[Sun Apr 08 03:23:02.040472 2018] [auth_digest:notice] [pid 20339] AH01757: generating secret for digest authentication ...
[Sun Apr 08 03:23:02.041376 2018] [lbmethod_heartbeat:notice] [pid 20339] AH02282: No slotmem from mod_heartmonitor
[Sun Apr 08 03:23:02.094944 2018] [mpm_prefork:notice] [pid 20339] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
[Sun Apr 08 03:23:02.094956 2018] [core:notice] [pid 20339] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Sun Apr 08 05:35:00.720095 2018] [autoindex:error] [pid 30351] [client 66.102.6.114:59512] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Sun Apr 08 09:42:05.222459 2018] [autoindex:error] [pid 30347] [client 52.34.24.33:31614] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Sun Apr 08 11:06:56.497939 2018] [autoindex:error] [pid 30790] [client 54.145.188.132:22136] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Sun Apr 08 14:13:12.731870 2018] [autoindex:error] [pid 32239] [client 185.198.167.29:51750] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Sun Apr 08 19:06:12.521882 2018] [autoindex:error] [pid 30348] [client 180.234.211.210:57961] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Sun Apr 08 19:06:15.004820 2018] [autoindex:error] [pid 30790] [client 159.203.81.93:36934] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive, referer: http://csedu.cf/noindex/css/open-sans.css
[Sun Apr 08 21:20:59.825782 2018] [autoindex:error] [pid 1338] [client 66.102.6.114:52716] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 00:25:17.935192 2018] [autoindex:error] [pid 30348] [client 178.73.215.171:58579] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 02:50:04.593613 2018] [autoindex:error] [pid 30351] [client 141.8.142.139:50790] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 03:17:12.517868 2018] [autoindex:error] [pid 30347] [client 222.186.173.47:3128] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 04:10:37.253275 2018] [autoindex:error] [pid 31639] [client 164.132.91.1:38580] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 05:38:34.833406 2018] [autoindex:error] [pid 30350] [client 66.249.70.23:49821] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 05:42:25.297309 2018] [autoindex:error] [pid 30790] [client 66.102.6.118:49432] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 08:37:04.505363 2018] [autoindex:error] [pid 1338] [client 66.249.64.17:47360] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 11:34:29.890432 2018] [autoindex:error] [pid 30349] [client 60.10.114.129:4892] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 12:21:16.013396 2018] [autoindex:error] [pid 30351] [client 66.249.64.147:61628] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 13:16:44.877416 2018] [autoindex:error] [pid 30348] [client 66.249.64.18:48720] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 13:28:05.782783 2018] [autoindex:error] [pid 31639] [client 54.67.59.131:47628] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 15:59:59.764704 2018] [autoindex:error] [pid 30349] [client 66.102.6.116:50307] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 20:48:48.419540 2018] [autoindex:error] [pid 30349] [client 211.23.154.138:44382] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 20:49:19.596952 2018] [autoindex:error] [pid 30790] [client 146.185.223.240:61291] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 20:49:25.365282 2018] [:error] [pid 32239] [client 146.185.223.240:53694] script '/var/www/html/xmlrpc.php' not found or unable to stat
[Mon Apr 09 20:49:30.881307 2018] [autoindex:error] [pid 1338] [client 146.185.223.240:57697] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 21:59:59.860423 2018] [autoindex:error] [pid 30790] [client 52.41.211.72:54578] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 22:40:17.025377 2018] [autoindex:error] [pid 32239] [client 66.102.6.118:63371] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Mon Apr 09 23:54:26.754931 2018] [autoindex:error] [pid 30350] [client 141.8.142.139:44732] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 02:04:12.364159 2018] [autoindex:error] [pid 30350] [client 66.249.64.17:46304] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 04:31:13.380666 2018] [autoindex:error] [pid 30349] [client 66.249.79.21:45988] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 05:11:35.587141 2018] [autoindex:error] [pid 32239] [client 66.249.79.19:52379] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 05:41:26.176137 2018] [autoindex:error] [pid 1338] [client 66.102.6.118:51864] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 05:57:36.520454 2018] [autoindex:error] [pid 30347] [client 66.249.79.110:36194] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 12:44:25.251573 2018] [autoindex:error] [pid 32239] [client 52.34.24.33:60587] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 13:08:39.896323 2018] [autoindex:error] [pid 1338] [client 141.8.142.139:53710] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 13:31:14.603115 2018] [autoindex:error] [pid 30790] [client 180.234.211.210:44472] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 13:42:16.181640 2018] [autoindex:error] [pid 30351] [client 107.170.192.57:54176] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 16:31:20.752769 2018] [autoindex:error] [pid 30349] [client 196.52.43.109:6666] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 17:43:24.572519 2018] [autoindex:error] [pid 1338] [client 66.102.6.118:64283] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Apr 10 23:32:45.653283 2018] [mpm_prefork:notice] [pid 20339] AH00170: caught SIGWINCH, shutting down gracefully
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs
0

The first Message httpd.service: main process exited, code=exited, status=1/FAILURE tells that the Service couldn't even be started. The next Message kill[11116]: kill: cannot find process "" wants to say that the Service Process couldn't be killed because it couldn't be started before.

According to the Log Messages from /var/log/httpd/error_log the Service stopped because of a Problem with your VirtualHost Definitions

(13)Permission denied: AH00091: httpd: could not open error log file /var/www/example2.com/error.log.
AH00015: Unable to open logs

If the Service cannot write into the configured Log Files because

  • The Directory does not exist
  • The Harddisk is readonly
  • The Harddisk is full

the Service cannot be started.

We will have to see the VirtualHost Configuration of example2.com, too.

I suspect that something is happening to your Service Configuration because on one hand the Log says that the DocumentRoot is at /var/www/html/
But than it wants to write the Logs at /var/www/example2.com/

  • Well you wouldn't want to write server logs to something underneath DocumentRoot anyway. Another possible cause is that /var/www/example2.com lacks the neccessary SElinux magic to allow the server to write there. (Check getenforce to see if SELinux is enabled.) – Ulrich Schwarz Apr 11 '18 at 9:50
  • @UlrichSchwarz /usr/sbin/sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 28 – alhelal Apr 11 '18 at 9:58
  • 1
    @UlrichSchwarz, @moon For Servers with SELinux enabled you need to check your Log Directory with ls -lZ to see if has the correct httpd_log_t Context. Actually it could have the wrong SELinux Context if you copied the Web Project from your Home Directory. – Bodo Hugo Barwich Apr 11 '18 at 10:06
  • @BodoHugoBarwich In /etc/httpd/conf/httpd.conf DocumentRoot is /var/www/html – alhelal Apr 11 '18 at 16:54
  • @BodoHugoBarwich And configuration of example.com is – alhelal Apr 11 '18 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.