6

I am trying to make a web server, but after adding the virtual hosts config, apache won't restart. It had several errors but I've managed to fix most of them. Now I don't know what is happening because journalctl -xn doesn't give me any hint.

Here are the logs:

[root@localhost victorscarone]# systemctl restart httpd.service
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
[root@localhost victorscarone]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: failed (Result: exit-code) since vie 2015-09-11 22:54:27 PYT; 2s ago
  Process: 2681 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 2679 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 2679 (code=exited, status=1/FAILURE)

sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
sep 11 22:54:27 localhost.localdomain kill[2681]: kill: cannot find process ""
sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 11 22:54:27 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
sep 11 22:54:27 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
[root@localhost victorscarone]# journalctl -xn
-- Logs begin at vie 2015-09-11 22:20:49 PYT, end at vie 2015-09-11 22:54:27 PYT. --
sep 11 22:48:29 localhost.localdomain kill[2658]: kill: cannot find process ""
sep 11 22:48:29 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 11 22:48:29 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 11 22:48:29 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
sep 11 22:54:27 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
--
-- Unit httpd.service has begun starting up.
sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
sep 11 22:54:27 localhost.localdomain kill[2681]: kill: cannot find process ""
sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 11 22:54:27 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 11 22:54:27 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.

Please help, it is for a good cause (my college work :D )

Edit #1 (09/12/2015 19:30 GMT -4)

I don't know what I just did, but testing the "httpd -t" command @garethTheRed told me, I wanted to see what help it had so I tried "httpd -H" and executed. Then running "apachectl restart" gave me the same error. But this time at seeing the "journalctl -xn" there was a change. There is still an error in the apache but it's already running with Test page 123. However vhost doesn't work yet.

Here are the outputs after that.

[root@localhost victorscarone]# httpd -t
Syntax OK
[root@localhost victorscarone]# httpd --help
[root@localhost victorscarone]# httpd --h
httpd (pid 2977) already running
[root@localhost victorscarone]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: failed (Result: exit-code) since sáb 2015-09-12 19:12:42 PYT; 4min 53s ago
  Process: 2965 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 2963 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 2963 (code=exited, status=1/FAILURE)

sep 12 19:12:42 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
sep 12 19:12:42 localhost.localdomain kill[2965]: kill: cannot find process ""
sep 12 19:12:42 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 12 19:12:42 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
sep 12 19:12:42 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost victorscarone]# apachectl restart
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
[root@localhost victorscarone]# journalctl -xn
-- Logs begin at sáb 2015-09-12 19:07:51 PYT, end at sáb 2015-09-12 19:18:32 PYT. --
sep 12 19:18:18 localhost.localdomain kill[2993]: kill: cannot find process ""
sep 12 19:18:18 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 12 19:18:18 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 12 19:18:18 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
sep 12 19:18:32 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
--
-- Unit httpd.service has begun starting up.
sep 12 19:18:32 localhost.localdomain httpd[3001]: httpd (pid 2977) already running
sep 12 19:18:32 localhost.localdomain kill[3003]: kill: cannot find process ""
sep 12 19:18:32 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 12 19:18:32 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 12 19:18:32 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.

[root@localhost victorscarone]# httpd -t
Syntax OK

Any ideas?

Edit #2 09/24/2015 19:29 (GMT -4) I'm sorry for the delay, haven't had time to continue with this but now I'm on it again. I've tried what @garethTheRed told, but it gets stuck at one point

[root@localhost victorscarone]# httpd -DFOREGROUND -e debug
[Thu Sep 24 19:26:01.249663 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module access_compat_module from /etc/httpd/modules/mod_access_compat.so
[Thu Sep 24 19:26:01.249913 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module actions_module from /etc/httpd/modules/mod_actions.so
[Thu Sep 24 19:26:01.249975 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module alias_module from /etc/httpd/modules/mod_alias.so
[Thu Sep 24 19:26:01.250021 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module allowmethods_module from /etc/httpd/modules/mod_allowmethods.so
[Thu Sep 24 19:26:01.250065 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module auth_basic_module from /etc/httpd/modules/mod_auth_basic.so
[Thu Sep 24 19:26:01.250130 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module auth_digest_module from /etc/httpd/modules/mod_auth_digest.so
[Thu Sep 24 19:26:01.250180 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_anon_module from /etc/httpd/modules/mod_authn_anon.so
[Thu Sep 24 19:26:01.250230 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_core_module from /etc/httpd/modules/mod_authn_core.so
[Thu Sep 24 19:26:01.250277 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_dbd_module from /etc/httpd/modules/mod_authn_dbd.so
[Thu Sep 24 19:26:01.250324 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_dbm_module from /etc/httpd/modules/mod_authn_dbm.so
[Thu Sep 24 19:26:01.250368 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_file_module from /etc/httpd/modules/mod_authn_file.so
[Thu Sep 24 19:26:01.250422 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_socache_module from /etc/httpd/modules/mod_authn_socache.so
[Thu Sep 24 19:26:01.250484 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_core_module from /etc/httpd/modules/mod_authz_core.so
[Thu Sep 24 19:26:01.250541 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_dbd_module from /etc/httpd/modules/mod_authz_dbd.so
[Thu Sep 24 19:26:01.250597 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_dbm_module from /etc/httpd/modules/mod_authz_dbm.so
[Thu Sep 24 19:26:01.250650 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_groupfile_module from /etc/httpd/modules/mod_authz_groupfile.so
[Thu Sep 24 19:26:01.250701 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_host_module from /etc/httpd/modules/mod_authz_host.so
[Thu Sep 24 19:26:01.250857 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_owner_module from /etc/httpd/modules/mod_authz_owner.so
[Thu Sep 24 19:26:01.250914 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_user_module from /etc/httpd/modules/mod_authz_user.so
[Thu Sep 24 19:26:01.250986 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module autoindex_module from /etc/httpd/modules/mod_autoindex.so
[Thu Sep 24 19:26:01.251082 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module cache_module from /etc/httpd/modules/mod_cache.so
[Thu Sep 24 19:26:01.251370 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module cache_disk_module from /etc/httpd/modules/mod_cache_disk.so
[Thu Sep 24 19:26:01.251431 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module data_module from /etc/httpd/modules/mod_data.so
[Thu Sep 24 19:26:01.251498 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dbd_module from /etc/httpd/modules/mod_dbd.so
[Thu Sep 24 19:26:01.251662 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module deflate_module from /etc/httpd/modules/mod_deflate.so
[Thu Sep 24 19:26:01.251805 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dir_module from /etc/httpd/modules/mod_dir.so
[Thu Sep 24 19:26:01.251873 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dumpio_module from /etc/httpd/modules/mod_dumpio.so
[Thu Sep 24 19:26:01.251929 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module echo_module from /etc/httpd/modules/mod_echo.so
[Thu Sep 24 19:26:01.251985 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module env_module from /etc/httpd/modules/mod_env.so
[Thu Sep 24 19:26:01.252044 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module expires_module from /etc/httpd/modules/mod_expires.so
[Thu Sep 24 19:26:01.252113 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module ext_filter_module from /etc/httpd/modules/mod_ext_filter.so
[Thu Sep 24 19:26:01.252184 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module filter_module from /etc/httpd/modules/mod_filter.so
[Thu Sep 24 19:26:01.252309 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module headers_module from /etc/httpd/modules/mod_headers.so
[Thu Sep 24 19:26:01.252392 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module include_module from /etc/httpd/modules/mod_include.so
[Thu Sep 24 19:26:01.252475 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module info_module from /etc/httpd/modules/mod_info.so
[Thu Sep 24 19:26:01.252547 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module log_config_module from /etc/httpd/modules/mod_log_config.so
[Thu Sep 24 19:26:01.252611 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module logio_module from /etc/httpd/modules/mod_logio.so
[Thu Sep 24 19:26:01.252684 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module mime_magic_module from /etc/httpd/modules/mod_mime_magic.so
[Thu Sep 24 19:26:01.252822 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module mime_module from /etc/httpd/modules/mod_mime.so
[Thu Sep 24 19:26:01.252916 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module negotiation_module from /etc/httpd/modules/mod_negotiation.so
[Thu Sep 24 19:26:01.252985 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module remoteip_module from /etc/httpd/modules/mod_remoteip.so
[Thu Sep 24 19:26:01.253050 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module reqtimeout_module from /etc/httpd/modules/mod_reqtimeout.so
[Thu Sep 24 19:26:01.253150 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module rewrite_module from /etc/httpd/modules/mod_rewrite.so
[Thu Sep 24 19:26:01.253219 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module setenvif_module from /etc/httpd/modules/mod_setenvif.so
[Thu Sep 24 19:26:01.253303 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module slotmem_plain_module from /etc/httpd/modules/mod_slotmem_plain.so
[Thu Sep 24 19:26:01.253373 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module slotmem_shm_module from /etc/httpd/modules/mod_slotmem_shm.so
[Thu Sep 24 19:26:01.253440 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module socache_dbm_module from /etc/httpd/modules/mod_socache_dbm.so
[Thu Sep 24 19:26:01.253503 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module socache_memcache_module from /etc/httpd/modules/mod_socache_memcache.so
[Thu Sep 24 19:26:01.253567 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module socache_shmcb_module from /etc/httpd/modules/mod_socache_shmcb.so
[Thu Sep 24 19:26:01.253638 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module status_module from /etc/httpd/modules/mod_status.so
[Thu Sep 24 19:26:01.253747 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module substitute_module from /etc/httpd/modules/mod_substitute.so
[Thu Sep 24 19:26:01.253823 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module suexec_module from /etc/httpd/modules/mod_suexec.so
[Thu Sep 24 19:26:01.253884 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module unique_id_module from /etc/httpd/modules/mod_unique_id.so
[Thu Sep 24 19:26:01.253960 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module unixd_module from /etc/httpd/modules/mod_unixd.so
[Thu Sep 24 19:26:01.254028 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module userdir_module from /etc/httpd/modules/mod_userdir.so
[Thu Sep 24 19:26:01.254094 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module version_module from /etc/httpd/modules/mod_version.so
[Thu Sep 24 19:26:01.254157 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module vhost_alias_module from /etc/httpd/modules/mod_vhost_alias.so
[Thu Sep 24 19:26:01.254350 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dav_module from /etc/httpd/modules/mod_dav.so
[Thu Sep 24 19:26:01.254491 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dav_fs_module from /etc/httpd/modules/mod_dav_fs.so
[Thu Sep 24 19:26:01.255042 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dav_lock_module from /etc/httpd/modules/mod_dav_lock.so
[Thu Sep 24 19:26:01.255892 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lua_module from /etc/httpd/modules/mod_lua.so
[Thu Sep 24 19:26:01.256053 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module mpm_prefork_module from /etc/httpd/modules/mod_mpm_prefork.so
[Thu Sep 24 19:26:01.256261 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_module from /etc/httpd/modules/mod_proxy.so
[Thu Sep 24 19:26:01.256362 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_bybusyness_module from /etc/httpd/modules/mod_lbmethod_bybusyness.so
[Thu Sep 24 19:26:01.256434 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_byrequests_module from /etc/httpd/modules/mod_lbmethod_byrequests.so
[Thu Sep 24 19:26:01.256505 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_bytraffic_module from /etc/httpd/modules/mod_lbmethod_bytraffic.so
[Thu Sep 24 19:26:01.256709 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_heartbeat_module from /etc/httpd/modules/mod_lbmethod_heartbeat.so
[Thu Sep 24 19:26:01.256904 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_ajp_module from /etc/httpd/modules/mod_proxy_ajp.so
[Thu Sep 24 19:26:01.257042 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_balancer_module from /etc/httpd/modules/mod_proxy_balancer.so
[Thu Sep 24 19:26:01.257142 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_connect_module from /etc/httpd/modules/mod_proxy_connect.so
[Thu Sep 24 19:26:01.257227 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_express_module from /etc/httpd/modules/mod_proxy_express.so
[Thu Sep 24 19:26:01.257334 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_fcgi_module from /etc/httpd/modules/mod_proxy_fcgi.so
[Thu Sep 24 19:26:01.257421 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_fdpass_module from /etc/httpd/modules/mod_proxy_fdpass.so
[Thu Sep 24 19:26:01.257543 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_ftp_module from /etc/httpd/modules/mod_proxy_ftp.so
[Thu Sep 24 19:26:01.257736 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_http_module from /etc/httpd/modules/mod_proxy_http.so
[Thu Sep 24 19:26:01.257861 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_scgi_module from /etc/httpd/modules/mod_proxy_scgi.so
[Thu Sep 24 19:26:01.258128 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module systemd_module from /etc/httpd/modules/mod_systemd.so
[Thu Sep 24 19:26:01.258301 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module cgi_module from /etc/httpd/modules/mod_cgi.so
[Thu Sep 24 19:26:01.272364 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module php5_module from /etc/httpd/modules/libphp5.so
  • Try as root: apachectl restart or /sbin/service httpd restart – Alfabravo Sep 12 '15 at 4:41
  • 2
    Try running httpd -t. This will test your config files and display either error message(s) or Syntax OK. – garethTheRed Sep 12 '15 at 7:45
  • @Alfabravo those 2 commands I've already tried and gave me the same response. Never the less I've tried again now and the same happened. – Victor Scarone Sep 12 '15 at 23:15
  • @garethTheRed The output of httpd -t is Syntax OK :/ :/ – Victor Scarone Sep 12 '15 at 23:16
  • 1
    That's expected. It means it's running and waiting for connections. You can read apache's error logs with sudo tail /var/log/httpd/error_log. – garethTheRed Sep 25 '15 at 19:30
8

I had a similar issue and it turns out that Apache didn't like the ErrorLog and CustomLog lines in the VirtualHost container. I commented them out and service started without a problem.

I'm guessing this has something todo with permissions in httpd.conf

  • 2
    I had the same problem and after takeing a look at /var/log/httpd/error_log I realized that apache had no selinux permissions to access the new logs for the virtualhost. – MADforFUNandHappy Oct 9 '17 at 8:30
  • I had this issue when using piped logs but had an incorrect path to the rotatelogs binary. – Walf Mar 28 '18 at 4:28
4

For anyone running into this issue in the future, don't disable SElinux, learn how to use it. Disabling it is almost like removing all safety off a firearm because the trigger won't work when you try to shoot.

This is the correct way to approach this issue:

`chcon -t httpd_sys_rw_content_t /var/www/html -R` 

Will allow apache permissions to read and write to the given directory.

Just systemctl restart httpd afterwards and you should be good to go.

As posted by @MADforFUNandHappy

  • Considering in the example that booting stops at the php module, /var/www/html isn't likely to be involved yet. If SELinux is suspected, I would start by looking at /var/log/audit/audit.log or /var/log/messages before making changes. Also, it is worth noting that chcon won't survive relabeling as mentioned at linuxfuse.blogspot.com/2015/03/… – Marty Aug 10 '18 at 16:38
  • @Marty what do you mean by will not survive re-labeling? and what would the proper approach be? – GeneralCan May 8 at 20:23
3

Try to fully reboot your system, it looks like it is trying to kill a process which no longer exists.

sudo reboot

When the system is fully rebooted, try to run the command again.

sudo systemctl restart httpd

This should work, if it doesn't, please post the 'journalctl -xn' output.

0

Maybe you have a semaphore problem...

Try to change your sysctl values:

kernel.msgmni = 1024
kernel.sem = 250 32000 100 512
kernel.shmmax = 16296951808
kernel.shmall = 17039360

Reload, and try to restart.

Regards

0

For me it worked by disabling selinux in CentOS7

For permanent disabling after reboot do:

sudo nano /etc/selinux/config

SELINUX=permissive or disabled

save the file

sudo setenforce 0

and check with

sestatus

  • why would you want to disable selinux ? Just add permission for apache. This for example to add rw permission # chcon -t httpd_sys_rw_content_t /var/www/html -R – MADforFUNandHappy Oct 9 '17 at 8:25
0

From what I've gathered, the general reason for this is because of SELinux permissions. When you create virtualhosts SELinux expects you to create SELinux types for each virtualhost so that each host can't trample on or read files from another host which makes sense.

If you've got policycoreutils installed you can use audit2why to have a look at what's being denied access and it often suggests ways to remedy this (it's not always the best way of fixing the problem, but often the quickest without just disabling SELinux).

For example to see all the denied access in the audit log: audit2why <<< "$(</var/log/audit/audit.log)"

You'll most likely see something along the lines of:

type=AVC msg=audit(1528554604.842:403): avc:  denied  { append } for  pid=34797 comm="httpd" name="error.log" dev="sda2" ino=51161328 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=file

    Was caused by:
    The boolean httpd_unified was set incorrectly.
    Description:
    Allow httpd to unified

    Allow access by executing:
    # setsebool -P httpd_unified 1

In this case enabling httpd_unified allows httpd to start properly again as it allows all vhosts to share the type context, which is less secure, but again it's better than turning SELinux off.

See: https://www.redhat.com/archives/fedora-selinux-list/2009-March/msg00070.html

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.