Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是什么导致Apache2在此配置文件中将PHP显示为纯文本?_Php_Ruby On Rails_Apache2_Thin - Fatal编程技术网

是什么导致Apache2在此配置文件中将PHP显示为纯文本?

是什么导致Apache2在此配置文件中将PHP显示为纯文本?,php,ruby-on-rails,apache2,thin,Php,Ruby On Rails,Apache2,Thin,我试图在同一个虚拟主机中运行PHP和Rails,但是PHP显示为纯文本。当我创建一个没有所有重写和代理重写的测试主机时,Apache2将根据需要处理PHP。我的配置文件哪里出错了 <VirtualHost *:80> #ServerName staging.domain.com #ServerAlias www.domain.com DocumentRoot /home/demo/vhosts/domain/public <Directory />

我试图在同一个虚拟主机中运行PHP和Rails,但是PHP显示为纯文本。当我创建一个没有所有重写和代理重写的测试主机时,Apache2将根据需要处理PHP。我的配置文件哪里出错了

<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>

#ServerName staging.domain.com
#ServerAlias www.domain.com
DocumentRoot/home/demo/vhosts/domain/public
选项如下符号链接
不允许超限
选项索引跟随符号链接多视图
不允许超限
命令允许,拒绝
通融
重新启动发动机
平衡员http://127.0.0.1:5000
平衡员http://127.0.0.1:5001
平衡员http://127.0.0.1:5002
#将所有非静态请求重定向到精简
重写cond%{DOCUMENT\u ROOT}/%{REQUEST\u FILENAME}-F
重写规则^/(.*)$balancer://thinservers%{REQUEST_URI}[P,QSA,L]
ProxyPass/balancer://thinservers/
ProxyPassReverse/balancer://thinservers/
代理主机
命令拒绝,允许
通融
#自定义日志文件位置
ErrorLog/home/demo/vhosts/domain/log/error.log
CustomLog/home/demo/vhosts/domain/log/access.log组合

检查您的httpd.conf文件,确保它正在加载php5模块,或者如果您使用mod_suphp,确保您没有同时加载这两个模块

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

选项索引+ExecCGI FollowSymLinks
命令允许,拒绝
通融

这更像是一个问题…

谢谢。我发现ProxyPass行导致PHP显示为纯文本。看起来我需要了解它到底在做什么。代理正在将击中www.domain.com和staging.domain.com的所有请求重定向到平衡器服务器或rails服务器或您在那里设置的任何东西。。。您可以尝试更具体一些,例如将/rails重定向到它,而不是/