views:

62

answers:

1

I am trying to run PHP and Rails in the same virtual host, however, PHP is being displayed as plain/text. When I create a test host without all the rewrites and proxy-ing, Apache2 will process the PHP as desired. Where in my config file have I gone wrong?

<VirtualHost *:80>
  #ServerName staging.domain.com
  #ServerAlias www.domain.com

  DocumentRoot /home/demo/vhosts/domain/public

  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  <Directory /home/demo/vhosts/domain/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
  </Directory>

  RewriteEngine On

  <Proxy balancer://thinservers>
    BalancerMember http://127.0.0.1:5000
    BalancerMember http://127.0.0.1:5001
    BalancerMember http://127.0.0.1:5002
  </Proxy>

  # Redirect all non-static requests to thin
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]

  ProxyPass / balancer://thinservers/
  ProxyPassReverse / balancer://thinservers/
  ProxyPreserveHost on

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  # Custom log file locations
  ErrorLog  /home/demo/vhosts/domain/log/error.log
  CustomLog /home/demo/vhosts/domain/log/access.log combined

</VirtualHost>
+1  A: 

Check your httpd.conf file and make sure it is loading the php5 module or if you use mod_suphp, make sure youre not loading both.

<Directory "/var/www/myrailsapp/public/">
        Options Indexes +ExecCGI FollowSymLinks 
        Order allow,deny
        Allow from all
</Directory>

This is more of a http://www.serverfault.com question ...

Prix
Thanks. I found that the *ProxyPass* line is what causing PHP to display as plain text. It looks like I need to learn what exactly that is doing.
rxgx
The proxy is redirecting all the requests that hit www.domain.com and staging.domain.com to the balancer server or rails server or whatever u have setted there ... you could trying being more specific for example redirecting /rails to it instead of /
Prix