2

I've set up and run a RAILS app (graylog2), and the below config made it work for root location:

server {
    server_name www.mydomain.com;

    location / {
        gzip off;
        uwsgi_modifier1 7;
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:3033;
    }
}

but I want to place my app in a path, ex: /graylog2

I changed my config, added uwsgi_param SCRIPT_NAME /graylog2 but it did not work.

server {

    server_name www.mydomain.com;

    root /opt/graylog2-web-interface/public/;
    location /graylog2 {
        gzip off;
        include uwsgi_params;
        uwsgi_param SCRIPT_NAME /graylog2;
        uwsgi_modifier1 7;
        uwsgi_pass graylog2;
    }

    location / {
        autoindex on;
    }
}

I'm using Ubuntu 12.04.1 LTS, nginx/1.1.19 with latest uwsgi compiled from git

Nginx access.log

127.0.0.1 - - [16/Mar/2013:12:26:31 +0700] "GET /graylog2/ HTTP/1.1" 404 609 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"
127.0.0.1 - - [16/Mar/2013:12:26:31 +0700] "GET /assets/error.css HTTP/1.1" 200 458 "http://localhost/graylog2/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"
127.0.0.1 - - [16/Mar/2013:12:26:31 +0700] "GET /assets/errorlogo.png HTTP/1.1" 200 11097 "http://localhost/assets/error.css" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"

No nginx error.log

uwsgi.log

[pid: 2321|app: 0|req: 15/25] 127.0.0.1 () {42 vars in 963 bytes} [Sat Mar 16 12:24:04 2013] GET /graylog2/ => generated 609 bytes in 31 msecs (HTTP/1.1 404) 7 headers in 237 bytes (0 switches on core 0)

What is the right way to config nginx + uwsgi for my set up?

Kevin Reid
  • 112
  • 7

1 Answers1

0

have you try this ? I'have use this tips with gitlab, it solve the same kind of issue...

location /graylog2 {
    gzip off;
    include uwsgi_params;
    uwsgi_param X-Url-Prefix http://www.mydomain.com/;
    uwsgi_modifier1 7;
    uwsgi_pass graylog2;
}
Thibault
  • 213