Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can get PHP and rails working in the same project if you have access to the server configuration. I was able to get things working on a test VPS in just a few minutes. I didn't test with wordpress, just a simple phpinfo() call, but I don't see any reason why it would fail.</p> <p>My install uses NGINX for the web server, Unicorn for Rails, and spawn-fcgi and php-cgi for the PHP processing.</p> <p>I already had a rails app working so I just added PHP to that. The rails app uses NGINX to proxy requests to Unicorn, so it was already serving the public directory as static. I will post my virtual host file below so you can see how it was done.</p> <p>This was all done on an ArchLinux VPS, but other distros should be similar.</p> <p>My virtual host file:</p> <pre><code>upstream unicorn { server unix:/tmp/unicorn.jrosw.sock fail_timeout=0; } server { listen 80 default deferred; server_name example.com www.example.com; root /home/example/app/current/public; location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; } try_files $uri/index.html $uri @unicorn; location @unicorn { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://unicorn; } error_page 500 502 503 504 /500.html; client_max_body_size 4G; keepalive_timeout 10; location ~ \.php$ { try_files $uri =404; include /etc/nginx/conf/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/example/app/current/public$fastcgi_script$ } } </code></pre> <p>And then a small script to bring up php-cgi:</p> <pre><code>#!/bin/sh # You may want to just set this to run as your app user # if you upload files to the php app, just to avoid # permissions problems if [ `grep -c "nginx" /etc/passwd` = "1" ]; then FASTCGI_USER=nginx elif [ `grep -c "www-data" /etc/passwd` = "1" ]; then FASTCGI_USER=www-data elif [ `grep -c "http" /etc/passwd` = "1" ]; then FASTCGI_USER=http else # Set the FASTCGI_USER variable below to the user that # you want to run the php-fastcgi processes as FASTCGI_USER= fi # Change 3 to the number of cgi instances you want. /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 3 -u $FASTCGI_USER -f /usr/bin/php-cgi </code></pre> <p>The only problem I had was getting the fastcgi_index option to work, so you'd probably need to look into <a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html" rel="nofollow">nginx's url rewriting</a> capabilities to get wordpress' permalink functionality working.</p> <p>I know this method isn't ideal, but hopefully it gets you on the right track.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload