• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] Apache "stolpert" über mod_log_config.conf

P6CNAT

Advanced Hacker
Hallo,

nach der Umstllung auf open SUSE Leap 42.1 wollte ich meinen Apache wieder in Betrieb nehmen.

Beim Start mit der Yast Dienste Verwaltung erhalte ich folgende Fehlermeldung:
Code:
apache2.service - The Apache Webserver
   Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled)
   Active: failed (Result: exit-code) since Thu 2016-05-12 16:27:18 CEST; 24min ago
  Process: 15904 ExecStop=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful-stop (code=exited, status=1/FAILURE)
  Process: 15899 ExecStart=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k start (code=exited, status=1/FAILURE)
 Main PID: 15899 (code=exited, status=1/FAILURE)

May 12 16:27:18 polaris start_apache2[15899]: AH00526: Syntax error on line 11 of /etc/apache2/mod_log_config.conf:
May 12 16:27:18 polaris start_apache2[15899]: Invalid command 'LogFormat', perhaps misspelled or defined by a module not included in the server configuration
May 12 16:27:18 polaris start_apache2[15904]: AH00526: Syntax error on line 11 of /etc/apache2/mod_log_config.conf:
May 12 16:27:18 polaris start_apache2[15904]: Invalid command 'LogFormat', perhaps misspelled or defined by a module not included in the server configuration
May 12 16:27:18 polaris systemd[1]: Failed to start The Apache Webserver.
Das ist das original mod_log_config.conf File von der Installation und entspricht exakt dem File unter Suse 3.1
Das File sieht so aus:
Code:
polaris:/etc/apache2 # cat -n mod_log_config.conf 
     1  #
     2  # The following directives define some format nicknames for use with
     3  # a CustomLog directive.
     4  #
     5  # http://httpd.apache.org/docs/2.4/mod/mod_log_config.html
     6  #
     7
     8  #
     9  #         Format string:                                Nickname:
    10  #
    11  LogFormat "%h %l %u %t \"%r\" %>s %b"                   common
    12  LogFormat "%v %h %l %u %t \"%r\" %>s %b"                vhost_common
    13  LogFormat "%{Referer}i -> %U"                           referer
    14  LogFormat "%{User-agent}i"                              agent
    15  LogFormat "%h %l %u %t \"%r\" %>s %b \
    16  \"%{Referer}i\" \"%{User-Agent}i\""                     combined
    17  LogFormat "%v %h %l %u %t \"%r\" %>s %b \
    18  \"%{Referer}i\" \"%{User-Agent}i\""                     vhost_combined
    19
    20  # To use %I and %O, you need to enable mod_logio
    21  <IfModule mod_logio.c>
    22  LogFormat "%h %l %u %t \"%r\" %>s %b \
    23  \"%{Referer}i\" \"%{User-Agent}i\" %I %O"               combinedio
    24  </IfModule>
    25
    26  # Use one of these when you want a compact non-error SSL logfile on a virtual
    27  # host basis:
    28  <IfModule mod_ssl.c>
    29  Logformat "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \
    30  \"%r\" %b"                                              ssl_common
    31  Logformat "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \
    32  \"%r\" %b \"%{Referer}i\" \"%{User-Agent}i\""           ssl_combined
    33  </IfModule>
    34
Kennt jemand das Problem? Im Internet habe ich nichts passendes gefunden.

Grüße
Georg
 
OP
P6CNAT

P6CNAT

Advanced Hacker
Hallo,

mittlerweile bin ich ein ganzes Stück weiter gekommen.
Die bisher gültigen vhost.conf Dateien funktionieren nicht mehr. Anhand des Templates /etc/apache2/vhosts.d/vhost.template habe ich eine neue Konfigurationsdatei erstellt.
Die funktioniert mit *html Dateien, aber nicht mit perl oder php Dateien.

Der entscheidende Unterschied zwischen den alten und neuen Konfigurationsdateien scheint "<IfModule !mod_access_compat.c>" im folgenden Abschnitt des Template zu sein:
Code:
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the realname directory are treated as applications and
    # run by the server when requested rather than as documents sent to the client.
    # The same rules about trailing "/" apply to ScriptAlias directives as to
    # Alias.
    #
    ScriptAlias /cgi-bin/ "/srv/www/vhosts/dummy-host.example.com/cgi-bin/"

    # "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have one, and where ScriptAlias points to.
    #
    <Directory "/srv/www/vhosts/dummy-host.example.com/cgi-bin">
        AllowOverride None
        Options +ExecCGI -Includes
        <IfModule !mod_access_compat.c>
            Require all granted
        </IfModule>
        <IfModule mod_access_compat.c>
            Order allow,deny
            Allow from all
        </IfModule>
    </Directory>

Laut Apache Doku
https://httpd.apache.org/docs/2.4/mod/core.html und https://httpd.apache.org/docs/current/mod/mod_access_compat.html
fragt IfModule, ob ein Modul geladen wurde. Und mod_access_compat.c ist der Sourcecode des Moduls mod_access_compat.
Mich wundert, dass Apache während der Laufzeit nach einem Sourcecode fragt, ist aber im ganzen Internet in der Form zu finden.

Hat jemand ein Beispiel für eine vhost.conf Datei die auch mit Serverseitigen Programmen wie perl, php oder python funktioniert?

Grüße
Georg
 
OP
P6CNAT

P6CNAT

Advanced Hacker
Hallo,

mit "a2enmod php5" habe ich jetzt auch php zum laufen bekommen. Ich dachte mit der Installation des Paketes apache2-mod_php5 wäre das erledigt.
Bei perl wirkt das Kommando aber nicht.
Hat jemand eine Idee, woran das liegen könnte, bzw. wie man perl zum laufen bringen kann?

Hier ist die Liste der geladenen Module
Code:
$ sudo apachectl -t -D DUMP_MODULES
root's password:
AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using 192.168.0.99. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_prefork_module (static)
 unixd_module (static)
 systemd_module (static)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_core_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 dir_module (shared)
 env_module (shared)
 expires_module (shared)
 include_module (shared)
 log_config_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 setenvif_module (shared)
 ssl_module (shared)
 socache_shmcb_module (shared)
 userdir_module (shared)
 reqtimeout_module (shared)
 wsgi_module (shared)
 authn_core_module (shared)
 php5_module (shared)
 perl_module (shared)

Grüße
Georg
 
OP
P6CNAT

P6CNAT

Advanced Hacker
Hallo spoensche,

ich habe nicht damit gerechnet, dass sich hier noch jemand meldet. Deshalb habe ich am Freitag noch einen Thread beim opensuse Forum geöffnet.

Vorab. Ich habe Leap 42.1 neu installiert und unterhalb des Verzeichnisses /etc/apache2 mit einer Ausnahme alles bei der original Installation belassen. Die Datei /etc/sysconfig/apache2 wird anscheinend von apachectl modifiziert.

Die Ausnahme. Unter /etc/apache2/vhosts.d hatte ich zunächst die funktionierenden config Dateien von openSUSE 3.1 angewandt. Dann aus dem neuen vhost.template eine angepasste vhost.conf Datei erstellt.

Hier die mod_perl Datei (original)
Code:
$ pwd
/etc/apache2/conf.d
$ ls -l
insgesamt 12
-rw-r--r-- 1 root root 793 14. Nov 2015  manual.conf
-rw-r--r-- 1 root root 819 11. Sep 2015  mod_perl.conf
-rw-r--r-- 1 root root 354  7. Jun 08:52 php5.conf
$ cat mod_perl.conf 
<Directory "/srv/www/perl-lib">
    AllowOverride None
    Options None
    <IfModule !mod_authz_host.c>
      Order allow,deny
      Deny from all
    </IfModule>
    <IfModule mod_authz_host.c>
      Require all granted
    </IfModule>
</Directory>
<IfModule mod_perl.c>
    PerlRequire "/etc/apache2/mod_perl-startup.pl"
    ScriptAlias /perl/ "/srv/www/cgi-bin/"
    <Location /perl/>
        # mod_perl mode
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        PerlOptions +ParseHeaders
        Options +ExecCGI
    </Location>
    ScriptAlias /cgi-perl/ "/srv/www/cgi-bin/"
    <Location /cgi-perl>
        # perl cgi mode
        SetHandler  perl-script
        PerlResponseHandler ModPerl::PerlRun
        PerlOptions +ParseHeaders
        Options +ExecCGI
    </Location>
    # The /cgi-bin/ ScriptAlias is already set up in httpd.conf
</IfModule>
Apache2 Verzeichnis
Code:
$ pwd
/etc/apache2
$ ls -l
insgesamt 152
-rw-r--r-- 1 root root  1764 14. Nov 2015  charset.conv
drwxr-xr-x 2 root root  4096  8. Jun 21:45 conf.d
-rw-r--r-- 1 root root  4128 14. Nov 2015  default-server.conf
-rw-r--r-- 1 root root  2924 14. Nov 2015  errors.conf
-rw-r--r-- 1 root root   128 14. Nov 2015  global.conf
-rw-r--r-- 1 root root  9033 14. Nov 2015  httpd.conf
-rw-r--r-- 1 root root  1053 14. Nov 2015  listen.conf
-rw-r--r-- 1 root root  1957 14. Nov 2015  loadmodule.conf
-rw-r--r-- 1 root root 13077 14. Nov 2015  magic
lrwxrwxrwx 1 root root    13 15. Mai 17:11 mime.types -> ../mime.types
-rw-r--r-- 1 root root  1503 14. Nov 2015  mod_autoindex-defaults.conf
-rw-r--r-- 1 root root   344 14. Nov 2015  mod_cgid-timeout.conf
-rw-r--r-- 1 root root   499 14. Nov 2015  mod_info.conf
-rw-r--r-- 1 root root  1057 14. Nov 2015  mod_log_config.conf
-rw-r--r-- 1 root root  5243 14. Nov 2015  mod_mime-defaults.conf
-rw-r--r-- 1 root root   763 11. Sep 2015  mod_perl-startup.pl
-rw-r--r-- 1 root root  1020 14. Nov 2015  mod_reqtimeout.conf
-rw-r--r-- 1 root root   456 14. Nov 2015  mod_status.conf
-rw-r--r-- 1 root root  1504 14. Nov 2015  mod_userdir.conf
-rw-r--r-- 1 root root    85 14. Nov 2015  mod_usertrack.conf
-rw-r--r-- 1 root root  4868 14. Nov 2015  server-tuning.conf
drwxr-xr-x 2 root root  4096 15. Mai 17:11 ssl.crl
drwxr-xr-x 2 root root  4096 15. Mai 17:11 ssl.crt
drwxr-xr-x 2 root root  4096 15. Mai 17:11 ssl.csr
-rw-r--r-- 1 root root  6388 14. Nov 2015  ssl-global.conf
drwx------ 2 root root  4096 15. Mai 17:11 ssl.key
drwxr-xr-x 2 root root  4096 15. Mai 17:11 ssl.prm
drwxr-xr-x 2 root root  4096 12. Mai 16:16 sysconfig.d
-rw-r--r-- 1 root root    22 14. Nov 2015  uid.conf
drwxr-xr-x 2 root root  4096 24. Jun 23:03 vhosts.d
und die vhost.conf Datei auf dem Stand von heute.
Zuletzt hatte ich noch cgi-perl und ein lokales mod_perl eingefügt. Allerdings hat das mein Problem nicht gelöst.
Code:
$ cat english.conf
#
# VirtualHost template
# Note: to use the template, rename it to /etc/apache2/vhost.d/yourvhost.conf. 
# Files must have the .conf suffix to be loaded.
#
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints 
# about virtual hosts.
#
# NameVirtualHost statements can be added to /etc/apache2/listen.conf.
#
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost english:80>
    # ServerAdmin webmaster@dummy-host.example.com
    ServerName english

    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    # DocumentRoot /srv/www/vhosts/dummy-host.example.com
    DocumentRoot /home//localhost/english

    # if not specified, the global error log is used
    ErrorLog  /var/log/apache2/localhost.english_error_log
    CustomLog /var/log/apache2/localhost.english_access_log combined

    # don't loose time with IP address lookups
    HostnameLookups Off

    # needed for named virtual hosts
    UseCanonicalName Off

    # configures the footer on server-generated documents
    ServerSignature On


    # Optionally, include *.conf files from /etc/apache2/conf.d/
    #
    # For example, to allow execution of PHP scripts:
    #
    # Include /etc/apache2/conf.d/php5.conf
    #
    # or, to include all configuration snippets added by packages:
    Include /etc/apache2/conf.d/*.conf


    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the realname directory are treated as applications and
    # run by the server when requested rather than as documents sent to the client.
    # The same rules about trailing "/" apply to ScriptAlias directives as to
    # Alias.
    #
    # ScriptAlias /cgi-bin/ "/srv/www/vhosts/dummy-host.example.com/cgi-bin/"
    ScriptAlias /cgi-bin/ "/home/name/localhost/english/bin/"

    # "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have one, and where ScriptAlias points to.
    #
    <Directory "/home/name/localhost/english/bin">
      AllowOverride None
      Options +ExecCGI -Includes +FollowSymLinks
         <IfModule !mod_access_compat.c>
            Require all granted
         </IfModule>
         <IfModule mod_access_compat.c>
            Order allow,deny
            Allow from all
         </IfModule>
    </Directory>

    # Nachträglich eingebaut, um perl scripte auszuführen
    <IfModule mod_perl.c>
    PerlRequire "/etc/apache2/mod_perl-startup.pl"
    ScriptAlias /perl/ "/home/name/localhost/english/bin/"
    <Location /perl/>
        # mod_perl mode
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        PerlOptions +ParseHeaders
        Options +ExecCGI
    </Location>
    ScriptAlias /cgi-perl/ "/home/name/localhost/english/bin/"
    <Location /cgi-perl>
        # perl cgi mode
        SetHandler  perl-script
        PerlResponseHandler ModPerl::PerlRun
        PerlOptions +ParseHeaders
        Options +ExecCGI
    </Location>
    # The /cgi-bin/ ScriptAlias is already set up in httpd.conf
</IfModule>




    # UserDir: The name of the directory that is appended onto a user's home
    # directory if a ~user request is received.
    #
    # To disable it, simply remove userdir from the list of modules in APACHE_MODULES
    # in /etc/sysconfig/apache2.
    #
    <IfModule mod_userdir.c>
        # Note that the name of the user directory ("public_html") cannot simply be
        # changed here, since it is a compile time setting. The apache package
        # would have to be rebuilt. You could work around by deleting
        # /usr/sbin/suexec, but then all scripts from the directories would be
        # executed with the UID of the webserver.
        UserDir public_html
        # The actual configuration of the directory is in
        # /etc/apache2/mod_userdir.conf.
        Include /etc/apache2/mod_userdir.conf
        # You can, however, change the ~ if you find it awkward, by mapping e.g.
        # http://www.example.com/users/karl-heinz/ --> /home/karl-heinz/public_html/
        #AliasMatch ^/users/([a-zA-Z0-9-_.]*)/?(.*) /home/$1/public_html/$2
    </IfModule>


    #
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "/home/name/localhost/english">
    
        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs/2.4/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks
    
        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
        AllowOverride None
    
        #
        # Controls who can get stuff from this server.
        #
        <IfModule !mod_access_compat.c>
            Require all granted
        </IfModule>
        <IfModule mod_access_compat.c>
            Order allow,deny
            Allow from all
        </IfModule>
    
    </Directory>

</VirtualHost>

Grüße
Georg
 

spoensche

Moderator
Teammitglied
Hast du die mod_perl.conf selbst geschrieben?

Ein
Code:
 LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
reicht normalerweise aus um das Modul zu laden.
 
OP
P6CNAT

P6CNAT

Advanced Hacker
spoensche schrieb:
Hast du die mod_perl.conf selbst geschrieben?
Nein, auf so ein kompliziertes Konstrukt wäre ich nicht gekommen, habe Mühe das überhaupt zu verstehen ;)

Vorsichtshalber habe ich die /etc von openSUSE 3.1 als Backup gesichert. Der Vergleich ergibt folgendes
Code:
$ diff  mod_perl.conf /etc/apache2/conf.d/mod_perl.conf 
4,5c4,10
<     Order allow,deny
<     Deny from all
---
>     <IfModule !mod_authz_host.c>
>       Order allow,deny
>       Deny from all
>     </IfModule>
>     <IfModule mod_authz_host.c>
>       Require all granted
>     </IfModule>
einen Ladebefehl für die mod_perl.so gab es in der alten Version auch nicht.

Grüße
Georg
 
OP
P6CNAT

P6CNAT

Advanced Hacker
Hallo,

habe den Fehler endlich gefunden. In der neuen Vorlage "/etc/apache2/vhosts.d/vhost.template" fehlt schlicht die Anweisung "SetHandler cgi-script". :irre:

Es ist wirklich Mist, wenn die die alten Konfig Dateien nicht mehr funktionieren und die neue Vorlage fehlerhaft ist. :zensur:

Grüße
Geor
 
Oben