All threads / Wordpress sub-directory on Rails App in a same server with setup using Capistrano, Passenger and Nginx.

Ask A Question

Notifications

You鈥檙e not receiving notifications from this thread.

Wordpress sub-directory on Rails App in a same server with setup using Capistrano, Passenger and Nginx.

AreaScoutsDeveloper asked in General

Hi sir,
Did anyone tried to setup rails app with alongwith wordpress blog and using capistrano, passenger and nginx setup? This will happen on the same server and the wordpress blog would be put on the public folder of rails. Actually, ive successfully setup the rails app with capistrano passenger nginx. The only i struggle here is when i tried to put the wordpress, maybe my nginx config is not right.

This what like happen.
mywebsite.com/blog

mywebsite.com - rails app
/blog - wordpress app

Thank you in advance, if someone can help me. 馃檪

You would need to basically add a block to your NGINX config to take /blog and render the Wordpress app.

location /blog {
  root /home/deploy/blog;

  try_files $uri $uri/ /index.php?$args;

  location ~ \.php$ {
    fastcgi_pass unix:/var/run/php7-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

Change root to point to where your Wordpress app lives and fastcgi_pass to point to your php-fpm sock file depending the version you're using.

ok sir i will try this. thanks

Hi sir, i tried your code. but still not fixed. this is the code that i used.
it always go to rails 404 page

location /tips {
root /var/www/html/tips;

try_files $uri $uri/ /index.php?$args;

location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

ive put tips on the try_files.
try_files $uri $uri/ /tips/index.php?$args;

and now display me a file not found.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,629+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.