Welcome! Log In Create A New Profile

Advanced

Problem with redmine/mongrel and nginx (proxy)

Posted by [HellR] 
Problem with redmine/mongrel and nginx (proxy)
May 22, 2010 09:42PM
Hi all,

I have a problem with the nginx configuration. I want nginx (http://mydomain.com/redmine) to be a proxy for mongrel (http://127.0.0.1:8000) but I get a routing error from mongrel because nginx is requesting http://127.0.0.1:8000/redmine. I am running nginx 0.7.65 on Debian Lenny and here is my configuration file :

[code]user www-data;
worker_processes 4;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;

access_log /var/log/nginx/access.log;

sendfile on;
tcp_nopush on;
resolver XXX.XXX.XXX.XXX;

keepalive_timeout 3;
tcp_nodelay off;

gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
client_header_buffer_size 64k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;

server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/certs/mycert.pem;
ssl_certificate_key /etc/ssl/private/mykey.pem;

server_name mydomain.com;
root /data/httpsdocs;
index index.php index.html index.htm;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log info;

location ^~ /redmine {
alias /data/redmine/public;
try_files $uri/index.html $uri.html $uri @mongrel;
}

location @mongrel {
proxy_pass http://127.0.0.1:8000;
}

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
}
}
}[/code]

If someone has the solution it would be great ;) Thanks a lot.



Edited 1 time(s). Last edit at 05/22/2010 09:46PM by [HellR].
Re: Problem with redmine/mongrel and nginx (proxy)
May 25, 2010 05:48AM
My problem is solved ;)

Here is the solution :

[b]nginx conf :[/b]
[code]
location ^~ /redmine {
root /data/redmine/public;
rewrite ^/redmine(?:$|/(.+)$) /$1 break;
try_files $uri/index.html $uri.html $uri @mongrel;
}

location @mongrel {
proxy_pass http://127.0.0.1:8000;
proxy_redirect default;
}
[/code]

[b]redmine conf[/b] ([i]add this line at the bottom of /data/redmine/config/enrivonment.rb[/i]) [b]:[/b]
[code]
Redmine::Utils::relative_url_root = "/redmine"
[/code]



Edited 1 time(s). Last edit at 05/25/2010 05:50AM by [HellR].
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 298
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready