I'm having trouble getting Phusion Passenger to serve a Rails app as well as a Drupal app, which live on the same server.
The Rails app lives in ~/Kiji and the Drupal app lives in ~/asia-gazette, as shown in the config below.
When I try running curl kiji.dev
I get the Rails app, which is correct. When I try running curl eag.dev
(the Drupal app) from the server I am getting a 200 response with nothing else. No output, nothing in the nginx error.log file.
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)
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:
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. I restart nginx and php5-fpm and:
$ 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. 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:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.