Rails App in Wordpress Subdirectory With NGINX - ruby-on-rails-3

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).
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

Set up RefineryCMS with Passenger

I'm trying to get a RefineryCMS install running on my CentOS VPS (which has DirectAdmin installed, which I don't think makes any difference for my problem) but somehow I cannot get it to host.
In my httpd.conf I've added the following:
RailsEnv development
PassengerHighPerformance on
|?DOCROOT=/home/user/domains/domain.name/public_html/rails/refinery_test_install/|
The paths are all correct and my normal Rails 3 applications work perfectly when I put these lines in my httpd.conf yet now it will just load the index.html file I've put in the directory pure for testing.
Any ideas on how I could get this up and running?
I was totally missing I didn't forwarded passenger to Rails' public folder. The configuration works with the following docroot:
|?DOCROOT=/home/user/domains/domain.name/public_html/rails/refinery_test_install/public/|

Nginx multiple locations with rails static assets

I am new to setting up my own server with nginx so forgive any ignorance. I may have just been using the wrong search terms to find the answers to my questions.
Anyway, I am using Rails 3, Nginx, and Unicorn at the moment on a VPS on rackspace. In my rails app I have about 500mb of files in public/ and I would like to use Nginx to serve these. Typically this is just:
server {
listen 80 default deferred;
# server_name example.com;
root /home/<my_user>/apps/<my_app>/current/public;
...
}
I can make this work if I add the 500mb in public to the git repo and then deploy with capistrano, but I don't want all of those files in my git repo. It makes no sense to store them there, but if I remove them then I have to manually go upload them to my public folder on the server every time I deploy.
Is there a way to make Nginx point to a second folder of assets for it to server? I tried the following:
location /static {
gzip on;
alias /home/deployer/static/;
}
I haven't had any luck getting this to work (trying to access the files via url.com/static/...) Anyone know what I am doing wrong?
Side note: all of the shown code is in my config/nginx.conf file and it SHOULD be overriding the settings via this line in my deploy.rb:
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
location /static/ {
root /home/deployer;
}
http://nginx.org/r/alias
http://nginx.org/r/root

Rack (Sinatra) App pointing '/' to parent's root when deployed in subfolder

I have a bunch of small sinatra apps, and now I have to publish them under SSL HTTP as well.
I have https://secure.mydomain.com/ and I want to publish those apps in subdirectories:
/app1
/app2
I followed Phusion Passenger instructions here to publish in subdirs, but inside each application '/' points to root directory.
I don't want to change the code of all apps because, they are already working in non-ssl environment.
What do I need to change to make my application's '/' point to app's root, and not parent's root?
Looks like you just need the url helper method:
url '/' # => https://secure.mydomain.com/app1/

Hosting personal pages over a Redmine installation

I currently installed redmine on my server, and configured apache2 to run it in a virtualhost over mydomain.com
Thing is I also want to host some extra pages, at mydomain.com/personal, but since redmine is running the page is never found. How can I override this configuration to run both redmine and some personal pages?
You need the Alias directive to just create a virtual directory, which maps /public with some other real directory on the filesystem.

rails3 : appending /app1 to apache virtual host url

I just installed a Rails 3 application on a development server, and it can be loaded by using http://server:3000/
In our production setup, all applications are proxied by apache running on another server. All applications are to be accessed by http://prodserver/appX . CSS and javascripts need to be loaded when using apache proxy.
How do I revise routes.rb and change rails.root to use appX, without changing the application?
Use the ProxyPassReverse configuration command in Apache and it will rewrite URL's so you don't have to change anything in routes.rb