Virtual hosts, include php.conf, DirectoryIndex failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi - While I have a work-around for this issue, I thought I would post it here to see what, if any, feedback I might get. Perhaps I am doing something wrong? I run a rather complex server environment where I use both Apache HTTPD and Apache Tomcat servers in combination and host a number of virtual hosts (named and all using the same IP address) On one of my virtual hosts I recently installed WordPress and this required me to also add in PHP support, since WordPress uses mostly PHP scripts. Since this is only needed on one of my virtual hosts, I tried to configure just that virtual host to include the additional stuff needed to support PHP. My attempts to do so failed and the workaround was to include the PHP configuration stuff (php7.conf) at a global level that will affect all the virtual hosts that I am supporting. For now, that is OK and won't bother anything but I am wondering why my initial approach failed and if there is something that I am missing or don't understand.

Basically, the symptoms, of what happened, was that the DirectoryIndex index.php setting fails when I just included the php7.conf file in the configuration file for the virtual host. But when I included the php7.file in the global http.conf or in the global default-server.conf files then it works! Error logs do not show anything other than the fact that an index file could not be found when referencing a directory that does indeed have an index.php file in it. I will show the pertinent config files (urls obscured) below in the configuration that fails, and I hope this is not overwhelming. First here is the version info for Apache just so we are all on the same page -

httpd -V
Server version: Apache/2.4.23 (Linux/SUSE)
Server built:   2017-03-22 14:54:04.000000000 +0000
Server's Module Magic Number: 20120211:61
Server loaded:  APR 1.5.1, APR-UTIL 1.5.3
Compiled using: APR 1.5.1, APR-UTIL 1.5.3
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_PROC_PTHREAD_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/srv/www"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="/var/log/apache2/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"

--------------------------------------------------------------------

Here is php7.conf that I am including -

cat php7.conf
<IfModule mod_php7.c>
       <FilesMatch "\.ph(p[345]?|tml)$">
           SetHandler application/x-httpd-php
       </FilesMatch>
       <FilesMatch "\.php[345]?s$">
           SetHandler application/x-httpd-php-source
       </FilesMatch>
        DirectoryIndex index.php4
        DirectoryIndex index.php5
        DirectoryIndex index.php
</IfModule>

--------------------------------------------------------------------

And this is my virtual host configuration (comments removed and URLs obscured)-

cat myvirtualhost.conf
<VirtualHost *:80>
    ServerAdmin me@xxxxxxxxxxxx
    ServerName www.myvirtualhost.org
    ServerAlias myvirtualhost.org
    DocumentRoot "/srv/tomcat/myvirtualhost_webapps/ROOT"
    ErrorLog "/var/log/apache2/myvirtualhost.org-error_log"
    TransferLog "/var/log/apache2/myvirtualhost.org-access_log"
    HostnameLookups Off
    UseCanonicalName Off
    ServerSignature On
    <IfModule mod_rewrite.c>
           RewriteEngine On
           RewriteCond %{HTTPS} off
           RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    </IfModule>

# THIS INCLUDE STATEMENT AND/OR THE DIRECTIVES IN PHP7.CONF FAILS FOR SOME UNKNOWN REASON!
  Include /etc/apache2/conf.d/php7.conf

    Alias /  /srv/tomcat/myvirtualhost_webapps/ROOT/
    <IfModule mod_jk.c>
         JkMount / tomcatWorker1
         JkMount /* tomcatWorker1
         JkUnMount /*.html tomcatWorker1
         JkUnMount /*.php tomcatWorker1
         JkUnMount /*.css tomcatWorker1
         JkUnMount /*.js tomcatWorker1
         JkUnMount /*.jpg  tomcatWorker1
         JkUnMount /*.png  tomcatWorker1
         JkUnMount /*.gif  tomcatWorker1
    </IfModule>
    ScriptAlias /cgi-bin/ "/srv/tomcat/myvirtualhost_webapps/ROOT/cgi-bin/"
    <Directory "/srv/tomcat/ahoa_webapps/ROOT/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>
    <IfModule mod_userdir.c>
        UserDir public_html
        Include /etc/apache2/mod_userdir.conf
    </IfModule>

    <Directory "/srv/tomcat/myvirtualhost_webapps/ROOT">
         Options +Indexes +FollowSymLinks
        AllowOverride None
        <IfModule !mod_access_compat.c>
            Require all granted
        </IfModule>
        <IfModule mod_access_compat.c>
            Order allow,deny
            Allow from all
        </IfModule>
       <IfModule sapi_apache2.c>
            php_admin_flag engine on
        </IfModule>
        <IfModule mod_php7.c>
            php_admin_flag engine on
        </IfModule>
    </Directory>
</VirtualHost>

as I said, if I move the "Include /etc/apache2/conf.d/php7.conf" statement to a global configuration file, then everything works OK. Any kind guru got an explanation, I don't grok this one... Perhaps this is a bug? Thanks in advance... Marc..

--
"The Truth is out there" - Spooky


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux