Apache mod_ext_filter not applied when using Fastcgi with ISPConfig3 ?

Discussion in 'Installation/Configuration' started by ircf, Oct 15, 2014.

  1. ircf

    ircf Member

    Hello,

    One of our webserver has the following config :
    - Linux Debian 7.0
    - ISPConfig 3.0.5.4p3
    - Fastcgi PHP and php5-fpm (we need both because some websites don't support fpm, namely old Typo3)
    - Apache2 on port 82
    - Nginx on port 80 (as reverse proxy, to server static files)
    - Piwik statistics
    - Apache2 mod_ext_filter + add-piwik filter, to enable piwik tracking on every website
    - To enable piwik filter for each website, we added the following code (programmatically) to each apache_directives on ISP Config, where XXX is the ISP Config website ID and YYY is the piwik website ID :

    Code:
    <IfModule ext_filter_module>
      <Directory /var/www/clients/client1/webXXX>
        SetEnv PIWIK_URL "stats.example.com/"
        SetEnv PIWIK_IDSITE "YYY"
        SetOutputFilter add-piwik
      </Directory>
    </IfModule>
    Everything works fine, except when we enable FastCGI PHP instead of php5-fpm, then the piwik filter does not work anymore. This is likely to be a problem in virtualhost config, but I can't figure out where...

    Below are samples of a working and a non-working config (server names have been changed).

    Thank you for your help !

    Website config with php5-fpm and mod_ext_filter (works great) :

    Code:
    <Directory /var/www/example.com>
    		AllowOverride None
    				Order Deny,Allow
    		Deny from all
    		</Directory>
    
    #<VirtualHost *:80>
    <VirtualHost *:82>
    
    					DocumentRoot /var/www/clients/client1/web13/web
    			
    		ServerName example.com
    		ServerAlias www.example.com
    		ServerAdmin [email protected]
    
    		ErrorLog /var/log/ispconfig/httpd/example.com/error.log
    
    
    		<IfModule mod_ssl.c>
    		</IfModule>
    
    		<Directory /var/www/example.com/web>
    				# Clear PHP settings of this website
    				<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    						SetHandler None
    				</FilesMatch>
    				Options +FollowSymLinks
    				AllowOverride All
    								Order allow,deny
    				Allow from all
    						</Directory>
    		<Directory /var/www/clients/client1/web13/web>
    				# Clear PHP settings of this website
    				<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    						SetHandler None
    				</FilesMatch>
    				Options +FollowSymLinks
    				AllowOverride All
    								Order allow,deny
    				Allow from all
    						</Directory>
    
    
    
    
    		<IfModule mod_fastcgi.c>
    				<Directory /var/www/clients/client1/web13/cgi-bin>
    										Order allow,deny
    					Allow from all
    								    </Directory>
    				<Directory /var/www/example.com/web>
    					<FilesMatch "\.php[345]?$">
    						SetHandler php5-fcgi
    					</FilesMatch>
    				</Directory>
    				<Directory /var/www/clients/client1/web13/web>
    					<FilesMatch "\.php[345]?$">
    						SetHandler php5-fcgi
    					</FilesMatch>
    				</Directory>
                    Action php5-fcgi /php5-fcgi
    				Alias /php5-fcgi /var/www/clients/client1/web13/cgi-bin/php5-fcgi-*-80-example.com
                    FastCgiExternalServer /var/www/clients/client1/web13/cgi-bin/php5-fcgi-*-80-ok.com -idle-timeout 300 -host 127.0.0.1:9022 -pass-header Authorization
    		</IfModule>
    
    
    		# add support for apache mpm_itk
    		<IfModule mpm_itk_module>
    			AssignUserId web13 client1
    		</IfModule>
    
    		<IfModule mod_dav_fs.c>
    		# Do not execute PHP files in webdav directory
    			<Directory /var/www/clients/client1/web13/webdav>
    				<ifModule mod_security2.c>
    					SecRuleRemoveById 960015
    					SecRuleRemoveById 960032
    				</ifModule>
    				<FilesMatch "\.ph(p3?|tml)$">
    					SetHandler None
    				</FilesMatch>
    			</Directory>
    			DavLockDB /var/www/clients/client1/web13/tmp/DavLock
    			# DO NOT REMOVE THE COMMENTS!
    			# IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
    			# WEBDAV END
    		</IfModule>
    
    <IfModule ext_filter_module>
      <Directory /var/www/clients/client1/web13>
        SetEnv PIWIK_URL "stats.example.com/"
        SetEnv PIWIK_IDSITE "8"
        SetOutputFilter add-piwik
      </Directory>
    </IfModule>
    </VirtualHost>
    
    Website config with Fastcgi and mod_ext_filter (mod_ext_filter does not work) :

    Code:
    <Directory /var/www/example.com>
    		AllowOverride None
    				Order Deny,Allow
    		Deny from all
    		</Directory>
    
    #<VirtualHost *:80>
    <VirtualHost *:82>
    
    					DocumentRoot /var/www/example.com/web
    			
    		ServerName example.com
    		ServerAlias www.example.com
    		ServerAdmin [email protected]
    
    		ErrorLog /var/log/ispconfig/httpd/example.com/error.log
    
    
    		<IfModule mod_ssl.c>
    		</IfModule>
    
    		<Directory /var/www/example.com/web>
    				# Clear PHP settings of this website
    				<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    						SetHandler None
    				</FilesMatch>
    				Options +FollowSymLinks
    				AllowOverride All
    								Order allow,deny
    				Allow from all
    						</Directory>
    		<Directory /var/www/clients/client1/web59/web>
    				# Clear PHP settings of this website
    				<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    						SetHandler None
    				</FilesMatch>
    				Options +FollowSymLinks
    				AllowOverride All
    								Order allow,deny
    				Allow from all
    						</Directory>
    
    
    
    
    		# suexec enabled
    		<IfModule mod_suexec.c>
    			SuexecUserGroup web59 client1
    		</IfModule>
    		# php as fast-cgi enabled
    	# For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
    		<IfModule mod_fcgid.c>
    				#IdleTimeout 300
    				#ProcessLifeTime 3600
    				# MaxProcessCount 1000
    				#DefaultMinClassProcessCount 0
    				#DefaultMaxClassProcessCount 100
    				#IPCConnectTimeout 3
    				#IPCCommTimeout 600
    				#BusyTimeout 3600
    		</IfModule>
    		<Directory /var/www/example.com/web>
    				<FilesMatch "\.php[345]?$">
    					SetHandler fcgid-script
    				</FilesMatch>
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php3
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php4
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php5
    				Options +ExecCGI
    				AllowOverride All
    								Order allow,deny
    				Allow from all
    						</Directory>
    		<Directory /var/www/clients/client1/web59/web>
    				<FilesMatch "\.php[345]?$">
    					SetHandler fcgid-script
    				</FilesMatch>
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php3
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php4
    				FCGIWrapper /var/www/php-fcgi-scripts/web59/.php-fcgi-starter .php5
    				Options +ExecCGI
    				AllowOverride All
    								Order allow,deny
    				Allow from all
    						</Directory>
    
    
    		# add support for apache mpm_itk
    		<IfModule mpm_itk_module>
    			AssignUserId web59 client1
    		</IfModule>
    
    		<IfModule mod_dav_fs.c>
    		# Do not execute PHP files in webdav directory
    			<Directory /var/www/clients/client1/web59/webdav>
    				<ifModule mod_security2.c>
    					SecRuleRemoveById 960015
    					SecRuleRemoveById 960032
    				</ifModule>
    				<FilesMatch "\.ph(p3?|tml)$">
    					SetHandler None
    				</FilesMatch>
    			</Directory>
    			DavLockDB /var/www/clients/client1/web59/tmp/DavLock
    			# DO NOT REMOVE THE COMMENTS!
    			# IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
    			# WEBDAV END
    		</IfModule>
    
    <IfModule ext_filter_module>
      <Directory /var/www/clients/client1/web59>
        SetEnv PIWIK_URL "stats.example.com/"
        SetEnv PIWIK_IDSITE "47"
        SetOutputFilter add-piwik
      </Directory>
    </IfModule>
    </VirtualHost
    
     
  2. ircf

    ircf Member

    Fixed Typo3

    Hello,

    We finally fixed Typo3 using this patch (v2) and then replaced fcgid by fpm in order to "fix" piwik ext filter.

    For now we'll use only fpm, and if it's not possible then we'll insert the piwik snippet manually.

    Thank you.
     

Share This Page