Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a Rails app to a sub-URI with Passenger and Nginx?

I am already deployed my Rails app with Passenger and Nginx and it's working fine. Below is my servier configuration:

server {
    listen       80;
    server_name  localhost;

    location / {
        root   /var/www/demo/public;
        passenger_enabled on;
        rails_env production;
    }

Now I want to deploy a second app to a sub URI. Here the documentation is a little unclear.

Could anyone please suggest me what will be the next configuration?

Below is the configuration I am using for my second (Sinatra) application:

location /log {
        root   /var/www/logger/public;
        passenger_base_uri /log;
        passenger_enabled on;
    }

I am getting "404 Not Found". Please suggest what I am missing here.

like image 239
Pravin Mishra Avatar asked Nov 19 '25 17:11

Pravin Mishra


1 Answers

Finally it's working!

nginx.conf:

server {
  listen       80;
  server_name  localhost;
  location / {
    root   /var/www/demo/public;
    passenger_enabled on;
    rails_env production;
  }

  location /test {
    root   /var/www/demo;
    passenger_base_uri /test;
    passenger_enabled on;
  }

Then:

ln -s /var/www/logger/public /var/www/demo/test

Thanks for all your help.

like image 66
Pravin Mishra Avatar answered Nov 21 '25 07:11

Pravin Mishra