Problems with php-fpm on Apache and /var/www/html

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,100
Location
Switzerland
Problem #1
On /var/www/html, only folders with a ProxyPassMatch directive will work. Putting a rule on /var/www/html directly will kill all websites and without it, scripts at the root will get a 404

Problem #2
Aliases don't work if calling the server's hostname directly (404), regardless of problem #1, but they do work from customers' domains.
Code:
Alias /autodiscover/autodiscover.xml /var/www/html/webmail/rpc.php
where the first part is virtual and the second one real

Problem #3
Rewrite rules for /var/www/html don't work, they always give a 404, regardless of problem #1
Code:
RewriteEngine On
RewriteRule ^/Microsoft-Server-ActiveSync /webmail/rpc.php [PT,L,QSA]
 
Last edited:
1. try to test it, on local webrowser like "lynx" andd see httpd error logs
2 .
Alias "/autodiscover/autodiscover.xml" "/var/www/html/webmail/rpc.php"
can be error, if the VH not configured good,
3. VH => localhost
 
Thanks for the suggestions :)
Is /var/www/html/ working perfectly for you using Apache + PHP-FPM and the standard config files?

1. Same result in Lynx, 404. And the logs show absolutely nothing
lynx my.hostname.com/myscript.php
homedir log
Code:
1621 "GET /myscript.php HTTP/1.0"
error_log
nada
php-fpm.log
doesn't even get created, but I suspect a permission issue. I'm not sure which user is writing logs when using php-fpm

2. vhost is configured with ServerName = server hostname
/etc/httpd/conf/extra/httpd-vhosts.conf
Code:
<VirtualHost 1.2.3.4:80:80>
    ServerAdmin [email protected]
    UserDir public_html
    DocumentRoot /var/www/html
    [B]ServerName my.hostname.com[/B]
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/

    CustomLog /var/log/httpd/homedir.log homedir
    ErrorLog /var/log/httpd/homedir-error.log

    <IfModule mod_fcgid.c>
        SuexecUserGroup webapps webapps
    </IfModule>
</VirtualHost>

3. localhost or servername give me the same result: 404
 
Thanks for the offer, but I can't do that.

And this seems to be a problem with CB not giving PHP access to the root of the server's VH, so it should be fixed in the script, not on just one server
 
Any update on this?

Was the current config broken on purpose to make mod_user work with the strange fastcgi + mod_proxy_fcgi config?
 
PHP-FPM support in CB 2.0 is still in the alpha stage,...
I think this should be added to the FAQ, because the main version reads 2.0.0 RC6 and that gives us the impression that it's close to production quality.

If mod_proxy_fcgi is broken, why not use mod_fastcgi everywhere instead of the current mix?

...and the answer to these questions depend on Apache developers. http://svn.apache.org/viewvc?view=revision&revision=r1560367 should solve most of the problems, but we haven't tested it yet (changes were made only ~6 hours ago).
Ah, that's good news :)
 
Possible solution for #1
In httpd-hostname.conf
Get rid of all the ProxyPassMatch

In httpd-vhosts.conf in both vistualhosts (80 & 443)
Add
Code:
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://socket=%2fusr%2flocal%2fphp54%2fsockets%2fwebapps.sock/var/www/html/$1
That will enable PHP 5.4 for /var/www/html and all sub-folders (PMA, roundcube, etc.). Modify according to your PHP
Standard files are still loaded properly

Possible solution for #2
You can get rid of mod_rewrite statements (they don't work) and keep the Alias ones, but they only work for customers domains and will raise security alerts in the customers' browsers because surely you're using SSL for your Web apps.
Implement server aliases using ProxyPassMatch
Code:
ProxyPassMatch ^/myalias$ fcgi://socket=%2fusr%2flocal%2fphp54%2fsockets%2fwebapps.sock/var/www/html/myserverapp$1
This will work for both customer.com/myalias (security alerts!) and server.com/myalias

DA forces a very short proxy timeout, at 60s, this may not be enough for some scripts.
Add this to your server virtualhost to restore the default value
ProxyTimeout 300

You can get persistent workers by using this patch
https://issues.apache.org/bugzilla/show_bug.cgi?id=43513
 
Last edited:
This problem is already solved in latest versions of CB 2.0 and DA. Please give it a try and let us know the results :) Thank you!
 
Back
Top