简体   繁体   English

帮助PHP和Ruby在Rails上共存

[英]helping php and ruby on rails coexist

I have a RoR app running on a server using Apache as the web server. 我有一个使用Apache作为Web服务器的服务器上运行的RoR应用程序。 I also have an instnace of moodle, an LMS based on PHP running. 我还有一家基于PHP运行的LMS的moodle。 I have placed the web root of moodle inside the RoR space and for the most part it is working ok. 我将穆迪网的根目录放在RoR空间中,并且在大多数情况下都可以正常工作。

Inside moodle, if I go to sitename.com/moodle/my RoR intercepts that request and reports that it cannot find the page. 在moodle内部,如果我转到sitename.com/moodle/my,RoR会拦截该请求并报告找不到该页面。 If I go to sitename.com/moodle/my/index.php it works fine. 如果我转到sitename.com/moodle/my/index.php,它可以正常工作。

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). 我尝试创建一个新的虚拟服务器,但是添加了另一个在443上运行的服务器却没有用(基于RoR的站点都在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. 有谁知道一种告诉RoR忽略moodle目录或让RoR自动检测并将index.php附加到路径的方法。

Me to had a same issue below is the apache2 config for the same kind of issue as describe below. 我下面有一个相同的问题是apache2配置,用于如下所述的相同类型的问题。 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. 示例文件夹是Rails应用程序文件夹,“ / en / blog”是我在其中安装了wordpress的rails应用程序公用文件夹中的文件夹路径,因此在下面的配置中,我们允许apache关闭对“ http:/ example的请求”的乘客.com / zh-CN / blog”,因此该请求不是由乘客处理的,并且该请求是作为正常php请求的服务,因此我能够在同一台服务器上运行wordpress博客和rails应用程序。

# !!! #!!! Be sure to point DocumentRoot to 'public'! 确保将DocumentRoot指向“ 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM