2

I have an Ubuntu 12.04 LTS VPS server that serves a static website with Nginx. I would like to set up a rails application that is accesible from the subfolder 'foo'. I use Passenger for serving the rails app

That is how I configured Nginx:

worker_processes 1; events { worker_connections 1024; } http { passenger_root /home/akarki/.rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5; passenger_ruby /home/akarki/.rvm/wrappers/ruby-1.9.3-p429/ruby; server_names_hash_bucket_size 64; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss; charset UTF-8; error_log /opt/nginx/logs/file.log warn; server { listen 80; server_name www.domain.com; return 301 $scheme://domain.com$request_uri; } server { listen 80; server_name domain.com; index index.html index.htm; root /srv/www/domain.com; passenger_enabled on; passenger_base_uri /foo; try_files $uri.htm $uri.html $uri/ =404; location = / { rewrite ^ /de permanent; } # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } 

The static website works as expected but the only URL of the rails app that is accessible is the root under 'http://domain.com/foo'

Any other url gives a 404 error.

Do you have any suggestion how to fix this?

1 Answer 1

0

The best solution I could find to this after searching a lot was to re-install and configure nginx with phusion passenger

sudo apt-get purge nginx nginx-common nginx-full sudo apt-get install nginx sudo nano /etc/nginx/nginx.conf # uncomment 'passenger_root' & 'passenger_ruby' paths accordingly sudo nano /etc/nginx/sites-enabled/default # replace with: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; server_name mydomain.com; passenger_enabled on; rails_env production; root /home/deploy/myapp/current/public; # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } sudo service nginx restart 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.