Failed Apache2 start, no error log

前端 未结 11 561
轮回少年
轮回少年 2021-02-01 02:41

I would restart Apache2 but there comes an Error

$ sudo service apache2 start

Starting web server apache2

Action \'start\' failed.
The Apache error log may hav         


        
相关标签:
11条回答
  • 2021-02-01 02:57

    I ran into this exact issue today. I had copied the entire /etc/httpd from RHEL 6 and put it onto a CentOS 6 system, and ensured all RPMs were installed.

    Anytime apache would be started, it would silently fail. It took an strace to find the culprit: I was using CustomLog to call a program that was not installed on the target system. Once I installed the expected program, Apache HTTP Server started right up.

    0 讨论(0)
  • 2021-02-01 02:58

    If we have no entries in log files then we can try to debug apache2 using this command:

    $ apache2 -S
    

    or

    $ apache2 -e debug
    

    Possible output:

    [Fri Apr 05 04:04:59.682880 2019] [core:warn] [pid 11086] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
    apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
    
    0 讨论(0)
  • 2021-02-01 03:00

    On XAMPP use

    D:\xampp\apache\bin>httpd -t -D DUMP_VHOSTS
    

    This will yield errors in your configuration of the virtual hosts

    0 讨论(0)
  • 2021-02-01 03:05

    On Apache on Linux there might be a problem that the configuration cannot be checked because of a problem with environment variables not being set. This is a false positive which only occurs when running apache2 -S from commandline (See previous answer from @simhumileco). For instance Config variable ${APACHE_RUN_DIR} is not defined.

    In order to fix this run source /etc/apache2/envvars from the commandline and then run `apache2 -S' to get to the real (possible) problems.

    root@fileserver:~# apache2 -S
    [Thu Apr 30 10:42:06.822719 2020] [core:warn] [pid 24624] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
    apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
    root@fileserver:~# source /etc/apache2/envvars
    root@fileserver:/root# apache2 -S
    AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
    VirtualHost configuration:
    <----snip---->
    ServerRoot: "/etc/apache2"
    Main DocumentRoot: "/var/www/html"
    Main ErrorLog: "/var/log/apache2/error.log"
    Mutex ldap-cache: using_defaults
    Mutex default: dir="/var/run/apache2/" mechanism=default
    Mutex mpm-accept: using_defaults
    Mutex watchdog-callback: using_defaults
    PidFile: "/var/run/apache2/apache2.pid"
    Define: DUMP_VHOSTS
    Define: DUMP_RUN_CFG
    User: name="www-data" id=33
    Group: name="www-data" id=33
    root@fileserver:/root#
    
    0 讨论(0)
  • 2021-02-01 03:06

    Try to disable SElinux or configuration virtualhost for SElinux

    to configuration with SElinux https://muchbits.com/apache-selinux-vhosts.html

    to disable SElinux https://linuxize.com/post/how-to-disable-selinux-on-centos-7/

    0 讨论(0)
  • 2021-02-01 03:12

    Syntax errors in the config file seem to cause problems. I found what the problem was by going to the directory and excuting this from the command line.

    httpd -e info 
    

    This gave me the error

    Syntax error on line 156 of D:/.../Apache Software Foundation/Apache2.2/conf/httpd.conf:
    Invalid command 'PHPIniDir', perhaps misspelled or defined by a module not included in the server configuration
    
    0 讨论(0)
提交回复
热议问题