Configuring Hg as backend

Maxim Dounin mdounin at mdounin.ru
Tue Nov 27 16:23:58 UTC 2012


Hello!

On Tue, Nov 27, 2012 at 05:10:02PM +0100, Gautier DI FOLCO wrote:

> Hi all,
> 
> I'm trying to set up Hg behind nginx (web view, clone, pull, push)
> following the
> official wiki: http://mercurial.selenic.com/wiki/HgServeNginx.
> I have created an empty repository ($ hg init t1), set up the following
> file (hgweb):
> [web]
> allow_push = *
> push_ssl = false
> baseurl = http://localhost/hg/
> 
> [paths]
> / = /tmp/hg/*
> 
> And the following nginx.conf:
> user              nginx;
> worker_processes  1;
> error_log  /var/log/nginx/error.log;
> pid        /run/nginx.pid;
> events {
>     worker_connections  1024;
> }
> http {
>     include       /etc/nginx/mime.types;
>     default_type  application/octet-stream;
>     access_log  /var/log/nginx/access.log  main;
>     error_log  /var/log/nginx/error.log  error;
>     sendfile        on;
>     keepalive_timeout  65;
>     include /etc/nginx/conf.d/*.conf;
>     server {
>         listen 80;
>         server_name localhost;
>     location ~ ^/hg/(.*)$ {
>         proxy_pass         http://127.0.0.1:8000/$1;
>     }

[...]

> is there some of you who have had the same issue? How did you solve the
> problem?
> Have you got ideas on how to solve it?

You essentially asked nginx to drop request arguments here due to 
proxy_pass with variables being handled specially by nginx.  Use 
this instead:

    location /hg/ {
        proxy_pass http://127.0.0.1:8080/;
    }

More details can be found here:

http://nginx.org/r/proxy_pass
http://nginx.org/r/location

-- 
Maxim Dounin
http://nginx.com/support.html



More information about the nginx mailing list