简体   繁体   English

Phusion乘客+(Rails + Drupal)=无法交付Drupal应用

[英]Phusion Passenger + (Rails + Drupal) = unable to deliver Drupal app

I'm having trouble getting Phusion Passenger to serve a Rails app as well as a Drupal app, which live on the same server. 我很难让Phusion Passenger提供服务于同一服务器上的Rails应用程序和Drupal应用程序。

The Rails app lives in ~/Kiji and the Drupal app lives in ~/asia-gazette, as shown in the config below. Rails应用程序位于〜/ Kiji中,而Drupal应用程序位于〜/ asia-gazette中,如下面的配置所示。

When I try running curl kiji.dev I get the Rails app, which is correct. 当我尝试运行curl kiji.dev我得到了Rails应用,这是正确的。 When I try running curl eag.dev (the Drupal app) from the server I am getting a 200 response with nothing else. 当我尝试从服务器运行curl eag.dev (Drupal应用程序)时,我得到的响应为200。 No output, nothing in the nginx error.log file. 没有输出,nginx error.log文件中没有任何内容。

Below is what my nginx.conf file looks like at the moment (note that I set the user for nginx as www-data so that it can be used by php5-fpm) 下面是我当前的nginx.conf文件的外观(请注意,我将nginx的用户设置为www-data,以便php5-fpm可以使用它)

user  www-data;
worker_processes  1;

error_log  logs/error.log;
events {
    worker_connections  1024;
}

http {
    passenger_root /home/dani/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48;
    passenger_ruby /home/dani/.rvm/gems/ruby-2.1.2/wrappers/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen              80;
        server_name         kiji.dev;
    passenger_enabled   on;
    root   /home/dani/Kiji/public;
       location ~ ^/(assets)/ {
       expires max;
       add_header Cache-Control public;
       gzip_static on;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   html;
  }
 }

    server {
      listen 80;

      root /home/dani/asia-gazette;
      server_name   eag.dev;

      location = /favicon.ico {
        log_not_found off;
        access_log off;
      }

      location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
      }

      # This is needed for Drush
      location = /backup {
        deny all;
      }

      # Very rarely should these ever be accessed outside of the LAN
      location ~* \.(txt|log)$ {
        allow 127.0.0.1;
        deny all;
      }

      location / {
        try_files $uri $uri/ =404;
        index index.php;
      }

      error_page 404 /404.html;
      error_page 500 502 503 504 /50x.html;
      location = /50x.html {
        root /home/dani/asia-gazette;
      }
      location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
      }
    }
  }

And my hosts file: 和我的主机文件:

127.0.0.1 kiji.dev  eag.dev

In my /etc/php5/fpm/pool.d/www.conf file, I have the following: 在我的/etc/php5/fpm/pool.d/www.conf文件中,我具有以下内容:

listen.owner = www-data
listen.group = www-data
;listen.mode = 0660

I've tried un-commenting the listen.mode and re-commenting but the result is the same. 我尝试取消注释listen.mode并重新注释,但是结果是相同的。 I restart nginx and php5-fpm and: 我重新启动nginx和php5-fpm并:

$ curl -v eag.dev
* Rebuilt URL to: eag.dev/
* Hostname was NOT found in DNS cache
*   Trying xxx.xxx.xxx.xxx...
* Connected to eag.dev (xxx.xxx.xxx.xxx) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: eag.dev
> Accept: */*
>
< HTTP/1.1 200 OK
* Server nginx/1.6.0 is not blacklisted
< Server: nginx/1.6.0
< Date: Mon, 28 Jul 2014 15:57:06 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.5.9-1ubuntu4.3
<
* Connection #0 to host eag.dev left intact

I'm really not sure what I'm doing wrong and why Passenger will not show my Drupal app. 我真的不确定自己在做什么错,为什么旅客不会显示我的Drupal应用程序。 Any help would be much appreciated. 任何帮助将非常感激。

Thank you! 谢谢!

After a lot of research and frustration, I think I found the solution. 经过大量的研究和沮丧,我认为我找到了解决方案。 Adding the following to /etc/nginx/conf/fastcgi.conf seems to have done the trick: /etc/nginx/conf/fastcgi.conf添加以下/etc/nginx/conf/fastcgi.conf似乎可以解决问题:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

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

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