I am trying to configure a dev server with nginx for two projects, one in rails and one in PHP. I want a base URL (dev.example.com) for both projects and for each of them (sub.example.com/rails_proj and dev.example.com/php_proj). My nginx conf looks like this:
server {
listen 80;
server_name dev.example.com;
passenger_enabled on;
passenger_app_env development;
passenger_buffer_response off;
root /var/www/dev;
location ~ ^/rails_proj {
root /public;
passenger_base_uri /rails_proj;
passenger_app_root /var/www/dev/rails_proj;
passenger_document_root /var/www/dev/rails_proj/public;
}
location ~ ^/php_proj {
root /web;
try_files $uri /app_dev.php$is_args$args;
location ~ \.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
}
The rails project works fine, but the PHP project gives me a “file not found” when I try to access dev.example.com/php_proj/app_dev.php and in the log. He says: FastCGI is sent to stderr: "Primary script is unknown." I found problems associated with this, and I tried several ways, but I can’t come up with something that works for both projects. How can i fix this?
source
share