Rails App in WordPress Subdirectory With NGINX

Still fairly new to NGINX.

I have a wordpress site which will be the root site, and a rails app which should be in a subdirectory (site.com/portal). I previously had this working with Passenger, but wanted to check out Puma (looking for zero downtime deploy).

Read More

I have another rails app working fine on Puma, and my wordpress site is working too. But I can’t seem to get my portal app to show up underneath my wordpress app. Before, with passenger, I symlinked the portal app inside the wordpress site and added some passenger directives to Nginx.

# Use rails app inside wordpress
location /portal {
  rails_env development;
  passenger_min_instances 2;
  passenger_enabled on;
  passenger_base_uri /portal;
}

I tried changing this to use root:

# With symlinked /var/www/portal/public -> /var/www/website/public/portal
location /portal {
  root  /var/www/portal/public;
}

But no matter what I do I either get forbidden or not found errors.

Everything I’ve found is for passenger, or a wordpress site inside the rails app. How can I use Puma, and put my rails app inside a wordpress site?

Here are my complete nginx configs for the two sites:

nginx/conf/sites-enabled/local.website.conf

nginx/conf/sites-enabled/ssl.local.portal.conf

Related posts

Leave a Reply