ruby - How to really set up a Rails 4.2 application in a subdirectory? Using nginx and puma -
first have tried hard long time. have application that's in /home/deploy/app/myapp , want deploy accessed in http://myurl.com/myapp because want have many others on same domain name.
the problem rails default configuration not working should. should put configuration in application.rb or in production.rb or environment variable (rails_relative_url_root) [ http://edgeguides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root ]. keep getting 404. way worked when put in routes.rb:
rails.application.routes.draw scope '/myapp' || '/' root 'home#index' end end
it fells wrong. "config.relative_url_root" should work. don't it?
and thing assets still wrong. can't them right. should do?
my nginx config is:
upstream myapp { server unix:///home/deploy/apps/myapp/shared/tmp/sockets/puma.sock; } server { listen 80; server_name myapp; keepalive_timeout 5; access_log /home/deploy/apps/myapp/current/log/production.access.log; error_log /home/deploy/apps/myapp/current/log/production.error.log info; if (-f $document_root/maintenance.html) { rewrite ^(.*)$ /maintenance.html last; break; } location @myapp { proxy_pass http://myapp; proxy_set_header host $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_redirect off; proxy_set_header x-forwarded-proto $scheme; } location /myapp { alias /home/deploy/apps/myapp/current/public; try_files $uri @myapp; } }
how can fix assets in way nginx server also?
thank you!
Comments
Post a Comment