Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mercurial hgweb无法在使用nginx的存储库中浏览_Mercurial_Nginx_Hgweb - Fatal编程技术网

mercurial hgweb无法在使用nginx的存储库中浏览

mercurial hgweb无法在使用nginx的存储库中浏览,mercurial,nginx,hgweb,Mercurial,Nginx,Hgweb,我已安装Mercurial,并希望使用hgweb在网页上显示存储库 我使用的是nginx,我可以访问存储库所在的页面,但结果似乎是空的(我可以看到标题栏[名称、说明等],但我看不到repo的内容) 我正在使用hgweb.cgi,并在那里设置config=“/var/hg/hgweb.config”来读取我定义的配置,如下所示: [paths] /repository=/var/hg/myrepository [extensions] hgext.highlight = [web] style

我已安装Mercurial,并希望使用hgweb在网页上显示存储库

我使用的是nginx,我可以访问存储库所在的页面,但结果似乎是空的(我可以看到标题栏[名称、说明等],但我看不到repo的内容)

我正在使用hgweb.cgi,并在那里设置config=“/var/hg/hgweb.config”来读取我定义的配置,如下所示:

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

[extensions]
hgext.highlight =

[web]
style = gitweb
allow_push = *
注意:目录/var/hg/myrepository/包含.hg目录

更新

我做了更多的测试,nginx配置中似乎有一些错误妨碍了安装工作。以下是我所拥有的:

    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;
}
我可以成功访问webhg.server.com,并且存储库中列出了最后更新的日期[因此,hgweb以某种方式读取了该日期]。但当我点击存储库名称或页面上的任何链接[RSS提要等]时,我才回到主页。

发现了问题

结果发现配置中缺少了一些FastCGIu参数

现在参数是:

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;
这一点非常重要

fastcgi_param   REQUEST_METHOD  $request_method;
为了避免错误,使用SSL时会出现“abort:HTTP错误405:push需要POST请求”


有了它,我可以浏览mercurial存储库

当您检查此设置时,您要
http://yourserver/
而不是
http://yourserver/repository