Wordpress sub-directory on Rails App in a same server with setup using Capistrano, Passenger and Nginx.
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.
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.