dsfdfdfd6576578
2014-02-17 16:19
浏览 62
已采纳

帮助php和ruby on rails共存

I have a RoR app running on a server using Apache as the web server. I also have an instnace of moodle, an LMS based on PHP running. I have placed the web root of moodle inside the RoR space and for the most part it is working ok.

Inside moodle, if I go to sitename.com/moodle/my RoR intercepts that request and reports that it cannot find the page. If I go to sitename.com/moodle/my/index.php it works fine.

I tried creating a new virtual server but adding a second server running on 443 didnt work (the RoR based site is all under ssl).

Does anyone know of a way to tell RoR to ignore the moodle dir or get RoR to automatically detect and append the index.php to the path.

图片转代码服务由CSDN问答提供 功能建议

我在使用Apache作为Web服务器的服务器上运行了一个RoR应用程序。 我也有一个moodle的实例,一个基于PHP运行的LMS。 我已将moodle的web根目录放在RoR空间内,并且大部分工作正常。

在moodle内部,如果我去sitename.com/moodle/my,RoR会拦截该请求并报告无法找到该页面。 如果我去sitename.com/moodle/my/index.php它工作正常。

我尝试创建一个新的虚拟服务器,但添加第二个服务器运行在443上没有工作(RoR 基于网站都在ssl下。

有没有人知道告诉RoR忽略moodle目录或让RoR自动检测并将index.php附加到路径的方法。 / p>

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doupuzhimuhan9216 2014-02-17 19:46
    已采纳

    Me to had a same issue below is the apache2 config for the same kind of issue as describe below. Example folder is the rails application folder and "/en/blog" are the folder path in public folder of rails application in which i had a wordpress install so below configuration allow's apache to turn off passenger for a request made to "http:/example.com/en/blog" so this request is not process by passenger and this request is service as a normal php request so i was able to have a wordpress blog and a rails application running on same server.

    # !!! Be sure to point DocumentRoot to 'public'!

      DocumentRoot /var/www/example/public
    
      #RailsEnv production      
      <Directory /var/www/example/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
      </Directory>
    
      <Location /en/blog>
         PassengerEnabled off
         <IfModule mod_rewrite.c>
           RewriteEngine On
           RewriteBase /en/blog/
           RewriteCond %{REQUEST_FILENAME} !-f
           RewriteCond %{REQUEST_FILENAME} !-d
           RewriteRule . /en/blog/index.php [L]
         </IfModule>
      </Location>
    

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题