M
M
Maxim Vasiliev2014-06-24 12:36:03
Nginx
Maxim Vasiliev, 2014-06-24 12:36:03

How to configure nginx+uwsgi+rails on subpath?

Available:

server {
  listen 81;

  location / {
    uwsgi_pass unix:///opt/redmine-2.5.1/tmp/uwsgi.sock;
    include uwsgi_params;
    uwsgi_modifier1 7;
  }
}

I want to:
server {
  listen 80;

  location /redmine {
    uwsgi_pass unix:///opt/redmine-2.5.1/tmp/uwsgi.sock;
    include uwsgi_params;
    uwsgi_param SCRIPT_NAME "/redmine";
    uwsgi_modifier1 7;
  }
}

Question: does rack/rails understand the script_name parameter at all and how can I pass it to it from nginx via uwsgi?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Vasiliev, 2014-06-24
@qmax

The following config turned out to be workable:

location ~ /redmine(?P<path>/.*) {
    uwsgi_pass unix:///opt/redmine-2.5.1/tmp/uwsgi.sock;
    include uwsgi_params;
    uwsgi_param SCRIPT_NAME /redmine;
    uwsgi_param PATH_INFO $path;
    uwsgi_modifier1 7;
  }

But at the same time, some of the urls in html are without a prefix.
Rather, it's redmine's problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question