Author Topic: Using mod_proxy  (Read 14133 times)

Offline ork

  • Newbie
  • *
  • Posts: 3
Using mod_proxy
« on: September 10, 2013, 12:00:11 PM »
I upgraded to Apache 2.4.4 which now uses php-fpm instead of mod_php.  Unfortunately, I'm having a lot of trouble getting it to proxy all the requests.  The best setup I have so far let's me view the login page, with working CSS and graphics.  However, upon clicking login, nothing happens and I get a 'File not found', so I'm sure I'm not handling mod_proxy correctly.

This has been very frustrating and I appreciate any insight.

# /etc/httpd/conf.d/ssl.conf
Code: [Select]
<VirtualHost *:443>
        ServerName mail.domain.org
        DocumentRoot /var/www/roundcubemail
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/domain.crt
        SSLCertificateKeyFile /etc/pki/tls/private/domain.key
        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/roundcubemail/$1
        ProxyPassMatch ^/index$ fcgi://127.0.0.1:9000/var/www/roundcubemail/index.php$1
        DirectoryIndex index.php
</VirtualHost>

This gets me a login page, visible at mail.domain.org/index.  But clicking login redirects me to mail.domain.org and a file not found.

# /var/log/httpd/error_log
Code: [Select]
[Tue Sep 10 10:42:20.330694 2013] [proxy_fcgi:error] [pid 20661:tid 139766112696064] [client 129.105.*.*:51544] AH01071: Got error 'Primary script unknown\n', referer: https://mail.domain.org/index

The goal would be to have everything show up at mail.domain.org.

I should also point out that the official httpd guide doesn't work, and results in a 'File not found.' page.
« Last Edit: September 10, 2013, 04:35:40 PM by ork »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Using mod_proxy
« Reply #1 on: September 10, 2013, 12:33:24 PM »
I haven't played with Apache 2.4.x so I'm not sure how much help I can be, but I'd guess its the following line:
Code: [Select]
ProxyPassMatch ^/index$ fcgi://127.0.0.1:9000/var/www/roundcubemail/index.php$1
Try:
Code: [Select]
ProxyPassMatch ^/index.php$ fcgi://127.0.0.1:9000/var/www/roundcubemail/index.php$1

Offline ork

  • Newbie
  • *
  • Posts: 3
Re: Using mod_proxy
« Reply #2 on: September 10, 2013, 03:00:01 PM »
Thanks for the feedback!  Interestingly, that leads to a 'File not found.' being displaying on both mail.domain.org and mail.domain.org/index.php.

The httpd error_log shows:
Code: [Select]
[Tue Sep 10 13:55:42.182882 2013] [proxy_fcgi:error] [pid 22024:tid 139909161531136] [client 129.105.*.*:55041] AH01071: Got error 'Primary script unknown\n'

The error seems to be a common one, although I can only find fixes using nginx, rather than Apache (example).
« Last Edit: September 10, 2013, 04:36:04 PM by ork »

Offline ork

  • Newbie
  • *
  • Posts: 3
Re: Using mod_proxy
« Reply #3 on: September 10, 2013, 03:51:55 PM »
Woot!  I have a working configuration now.  Not sure how I didn't try this previously...

Code: [Select]
<VirtualHost *:443>
        DocumentRoot /var/www/roundcubemail
        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/roundcubemail/$1
        ProxyPassMatch ^/$ fcgi://127.0.0.1:9000/var/www/roundcubemail/index.php$1
        DirectoryIndex index.php
</VirtualHost>