Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've set up and run a RAILS app (graylog2), and bellow config made it worked 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 dit 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;
    }
}

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? Thanks.

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

share|improve this question
    
AFAIK uwsgi_pass adds the path in the location to the path it requests from the backend, so either do a rewrite before that. –  David Kohen Mar 19 '13 at 9:04

1 Answer 1

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;
}
share|improve this answer
    
this does not work, got all same output as my config –  HVNSweeting Mar 23 '13 at 2:50
    
if it's just to serve static files, you can use try_file option (wiki.nginx.org/HttpCoreModule#try_files) and keep graylog2 on / or you can setting up a new subdomain (graylog2.mydomain.com). I have the same kind of issue with Django... You can rewrite the url router file to be compliant with /graylog rather than / . –  0xBAADF00D Mar 24 '13 at 11:55
    
my scenarios is my company provide me only one domain sub.mydomain.com. I used / to serve my home page, that why I need setup this software on /graylog2. I know nothing about Ruby on Rails, just want to setup and use that software. Thank you for all your advices. –  HVNSweeting Mar 24 '13 at 16:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.