i have Mercurial installed and would like to use the hgweb to show also the repository on a webpage.

I am using nginx and I can acess the page where the repository is, but it seems that is coming out just empty (I can see the header columns [name, description and so on..] but I cannot see the content of the repo)

I am using hgweb.cgi and I setup there the config = "/var/hg/hgweb.config" to read the config that I defined like this:

[paths]
/repository=/var/hg/myrepository

[extensions]
hgext.highlight =

[web]
style = gitweb
allow_push = *

Note: the directory /var/hg/myrepository/ is containg the .hg dir.

UPDATE

I made more tests and it seems that there are some errors in the nginx config that are preventing the setup to work. Here is what I have:

    server {
      listen 443 ssl;

      ssl on;
      ssl_certificate /usr/local/nginx/conf/server.crt;
      ssl_certificate_key /usr/local/nginx/conf/server.key;

      ssl_session_timeout  20m;
      ssl_protocols  SSLv2 SSLv3 TLSv1;
      ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
      ssl_prefer_server_ciphers   on;     
      server_name webhg.server.com *.webhg.server.com;        
      root   /var/www ;

      location  /  {
        fastcgi_pass    hg-fpm;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;             
        include         fastcgi_hg;        
        auth_basic            "private!";
        auth_basic_user_file /var/hg/hg.htpasswd;
      }

      location /static/ {
         rewrite       /static/(.*)  /$1 break;
         root          /usr/share/mercurial/templates/static;
         expires 30d;
      }

    location ~ /\. {   deny all;        }        
}
## Redirect for insecure
server {
    server_name  webhg.server.com;
    listen 80;
       rewrite ^(.*) https://$host$1 permanent;
}

I can access successfully the webhg.server.com and the repository is listed with the last updated date [so this is read by hgweb somehow]. But when I click on the repository name or any links on the page [RSS feeds and so on] I just got back to the main page.

有帮助吗?

解决方案

Found the issue,

Turned out that there were some missing fastcgi_param in the config

now the params are:

fastcgi_split_path_info ^(/hg)(.*)$;
fastcgi_param   SCRIPT_FILENAME  $document_root/hgweb.cgi;

fastcgi_param  PATH_INFO          $fastcgi_path_info;
fastcgi_param  AUTH_USER          $remote_user;
fastcgi_param  REMOTE_USER        $remote_user;
fastcgi_param  SERVER_PORT        $server_port;

fastcgi_param   PATH_INFO   $fastcgi_script_name;
fastcgi_param   QUERY_STRING    $query_string;
fastcgi_param   CONTENT_TYPE    $content_type;
fastcgi_param   CONTENT_LENGTH  $content_length;
fastcgi_param   SERVER_PROTOCOL $server_protocol;
fastcgi_param   SERVER_PORT $server_port;
fastcgi_param   SERVER_NAME $server_name;

and this one is really important

fastcgi_param   REQUEST_METHOD  $request_method;

to avoid the error : "abort: HTTP Error 405: push requires POST request" when using SSL.

And with this I can browse the mercurial repository

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top