I'm currently trying to get my server to work with both rails and php. Currently I have Apache2 installed with PHP (Default from the provider)
But I'm trying to get rails to work also. We use PHP on our main domain, and are going to have a subdomain where the rails application will run from.
There's no must for Apache2, but how can I get both rails and php to work on the same server?
UPDATE Failed to use apache and are now trying to get it done with nginx which I have used before. But my problem is to get PHP working. I have my rails app working, but I can't get the PHP to work. Currently I have this in my config file.
server {
listen 80;
server_name www.domain.no domain.no;
location = / {
root /var/www/vhosts/domain.com/httpdocs;
index index.php index.html index.htm;
}
location / {
root /var/www/vhosts/domain.com/httpdocs;
index index.php index.html index.htm;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /var/www/vhosts/domain.com/httpdocs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME /var/www/vhosts/domain.com/httpdocs/$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}
}
But when I try to access a php file I just get redirected to www.domain.com//service
Any idea?