List for cgit developers and users
 help / color / mirror / Atom feed
* cannot get cgit display anything except the repo listing page
@ 2021-08-13  7:12 Torsten Kuehnel
  2021-08-13 11:33 ` Ariel Costas
  2021-08-13 21:22 ` Torsten Kuehnel
  0 siblings, 2 replies; 10+ messages in thread
From: Torsten Kuehnel @ 2021-08-13  7:12 UTC (permalink / raw)
  To: cgit

Dear cgit developer,

i have a problem getting cgit display useful information.
i compiled and installed cgit-1.2.3 like it is decribed in the README file and set it up via nginx fastcgi fcgiwrap

nginx config:

server {
	listen 85.17.xx.xx:443 ssl;
	server_name my.domain.com;
        root /var/www/htdocs/cgit;

        access_log  /var/log/cgit/access.log;
        error_log   /var/log/cgit/error.log;

        ssl_certificate /etc/letsencrypt/live/my.domain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/my.domain.com/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
	try_files   $uri @cgit;

        location ~* ^.+\.(css|png|ico)$ {
                 expires 0;
            }

        location @cgit {
                include fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME  /var/www/htdocs/cgit/cgit.cgi;
                fastcgi_pass   unix:/var/run/fcgiwrap.socket;
                fastcgi_param  PATH_INFO $uri;
                fastcgi_param  HTTP_HOST $server_name;
                fastcgi_param  QUERY_STRING  $args;
        }
}


/etc/cgitrc:

root-title=Git Verzeichnisse
css=/cgit.css
logo=/cgit.png
snapshots=tar.gz tar.bz2

scan-path=/tmp/

virtual-root=/
enable-index-links=1
enable-log-filecount=1
enable-log-linecount=1
enable-commit-graph=1

In the /tmp/ directory is a git repository "repo01" with one commit in it, owned completely by www-data, the user nginx is run with.

The result ist displaying the proper cgit "welcome" page with the one repo listed, Idle for 8 minutes. But the problem is, following any of the presented links like "summary", "log", or "tree", results in displaying the same entry page which lists the repo, but shows no content.

Spent to days on playing around with the nginx and cgitrc config, but nothing useful happens. The permissions on the repo are fully set to the www-data user. The url changes when i choose a link, but the displayed result is always the same, displaying the overview page of available repos.

Thanks for any help in advance.

Torsten Dieter Kuehnel
--
Torsten Kuehnel <net_seeker@web.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-13  7:12 cannot get cgit display anything except the repo listing page Torsten Kuehnel
@ 2021-08-13 11:33 ` Ariel Costas
  2021-08-13 20:39   ` Torsten Kuehnel
  2021-08-13 21:22 ` Torsten Kuehnel
  1 sibling, 1 reply; 10+ messages in thread
From: Ariel Costas @ 2021-08-13 11:33 UTC (permalink / raw)
  To: cgit

Hi there,

Looks like nginx is passing the requests correctly to cgit, but not the request
URI, as cgit is always returning the same page. So, all requests to `/repo01`
are treated as `/`.

Have you checked for something relevant in the access/error logs?

-- 
Ariel Costas (https://costas.dev)
Encrypt your email -- https://emailselfdefense.org/
GnuPG  public  key -- https://costas.dev/pgp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-13 11:33 ` Ariel Costas
@ 2021-08-13 20:39   ` Torsten Kuehnel
  2021-08-13 21:24     ` Ariel Costas
  0 siblings, 1 reply; 10+ messages in thread
From: Torsten Kuehnel @ 2021-08-13 20:39 UTC (permalink / raw)
  To: cgit

On Fri, 13 Aug 2021 11:33:49 +0000
Ariel Costas <ariel@costas.dev> wrote:

> Hi there,
>
> Looks like nginx is passing the requests correctly to cgit, but not the request
> URI, as cgit is always returning the same page. So, all requests to `/repo01`
> are treated as `/`.
>
> Have you checked for something relevant in the access/error logs?

The error log is clean, the access.log shows following entries selecting the "tree" link:

87.176.40.180 - - [13/Aug/2021:22:34:28 +0200] "GET /repo01/tree/ HTTP/2.0" 200 803 "https://my.domain.com/repo01/" "Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0"

>
> --
> Ariel Costas (https://costas.dev)
> Encrypt your email -- https://emailselfdefense.org/
> GnuPG  public  key -- https://costas.dev/pgp


--
Torsten Kuehnel <net_seeker@web.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-13  7:12 cannot get cgit display anything except the repo listing page Torsten Kuehnel
  2021-08-13 11:33 ` Ariel Costas
@ 2021-08-13 21:22 ` Torsten Kuehnel
  1 sibling, 0 replies; 10+ messages in thread
From: Torsten Kuehnel @ 2021-08-13 21:22 UTC (permalink / raw)
  To: cgit

On Fri, 13 Aug 2021 09:12:05 +0200
Torsten Kuehnel <net_seeker@web.de> wrote:

Switching to uwsgi to connect nginx with cgit works out. Looks like fcgiwrap messes things up. Don't ask me for the exact reason.

> Dear cgit developer,
>
> i have a problem getting cgit display useful information.
> i compiled and installed cgit-1.2.3 like it is decribed in the README file and set it up via nginx fastcgi fcgiwrap
>
> nginx config:
>
> server {
> 	listen 85.17.xx.xx:443 ssl;
> 	server_name my.domain.com;
>         root /var/www/htdocs/cgit;
>
>         access_log  /var/log/cgit/access.log;
>         error_log   /var/log/cgit/error.log;
>
>         ssl_certificate /etc/letsencrypt/live/my.domain.com/fullchain.pem;
>         ssl_certificate_key /etc/letsencrypt/live/my.domain.com/privkey.pem;
>         include /etc/letsencrypt/options-ssl-nginx.conf;
>         ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
> 	try_files   $uri @cgit;
>
>         location ~* ^.+\.(css|png|ico)$ {
>                  expires 0;
>             }
>
>         location @cgit {
>                 include fastcgi_params;
>                 fastcgi_param  SCRIPT_FILENAME  /var/www/htdocs/cgit/cgit.cgi;
>                 fastcgi_pass   unix:/var/run/fcgiwrap.socket;
>                 fastcgi_param  PATH_INFO $uri;
>                 fastcgi_param  HTTP_HOST $server_name;
>                 fastcgi_param  QUERY_STRING  $args;
>         }
> }
>
>
> /etc/cgitrc:
>
> root-title=Git Verzeichnisse
> css=/cgit.css
> logo=/cgit.png
> snapshots=tar.gz tar.bz2
>
> scan-path=/tmp/
>
> virtual-root=/
> enable-index-links=1
> enable-log-filecount=1
> enable-log-linecount=1
> enable-commit-graph=1
>
> In the /tmp/ directory is a git repository "repo01" with one commit in it, owned completely by www-data, the user nginx is run with.
>
> The result ist displaying the proper cgit "welcome" page with the one repo listed, Idle for 8 minutes. But the problem is, following any of the presented links like "summary", "log", or "tree", results in displaying the same entry page which lists the repo, but shows no content.
>
> Spent to days on playing around with the nginx and cgitrc config, but nothing useful happens. The permissions on the repo are fully set to the www-data user. The url changes when i choose a link, but the displayed result is always the same, displaying the overview page of available repos.
>
> Thanks for any help in advance.
>
> Torsten Dieter Kuehnel
> --
> Torsten Kuehnel <net_seeker@web.de>


--
Torsten Kuehnel <net_seeker@web.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-13 20:39   ` Torsten Kuehnel
@ 2021-08-13 21:24     ` Ariel Costas
  2021-08-13 22:03       ` Torsten Kuehnel
  0 siblings, 1 reply; 10+ messages in thread
From: Ariel Costas @ 2021-08-13 21:24 UTC (permalink / raw)
  To: cgit

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

It does seem like a problem when calling the CGI script. Perhaps you
could debug what cgit is getting from your NGINX?

You could try creating a new file `/var/www/htdocs/cgit/debug.cgi` with
the contents:

    #!/bin/bash
    echo "Content-Type: text/plain"
    echo ""
    printenv

What this script does is: run bash, respond with the Content-Type header
and a plaintext body containing all the environment variables passed by
NGINX.

Give it execution permissions and owned by www-data, then point NGINX to
that script and visit the site. Check the QUERY_STRING, PATH_INFO and
HTTP_HOST and see if they are the correct ones. Is there something strange?

-- 
Ariel Costas (https://costas.dev)
Encrypt your email -- https://emailselfdefense.org/
  GnuPG public key -- https://costas.dev/pgp

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-13 21:24     ` Ariel Costas
@ 2021-08-13 22:03       ` Torsten Kuehnel
  2021-08-14 22:10         ` Ariel Costas
  0 siblings, 1 reply; 10+ messages in thread
From: Torsten Kuehnel @ 2021-08-13 22:03 UTC (permalink / raw)
  To: cgit

On Fri, 13 Aug 2021 21:24:58 +0000
Ariel Costas <ariel@costas.dev> wrote:

here comes the content:

HTTP_ACCEPT_ENCODING=gzip, deflate, br
SERVER_NAME=my.domain.com
HTTPS=on
SCRIPT_NAME=/
REDIRECT_STATUS=200
GATEWAY_INTERFACE=CGI/1.1
HTTP_SEC_GPC=1
SERVER_SOFTWARE=nginx/1.14.2
PATH_INFO=/
DOCUMENT_ROOT=/var/www/htdocs/cgit
HTTP_UPGRADE_INSECURE_REQUESTS=1
PWD=/var/www/htdocs/cgit
LOGNAME=www-data
REQUEST_URI=/
PATH_TRANSLATED=/var/www/htdocs/cgit
FCGI_ROLE=RESPONDER
REQUEST_SCHEME=https
HOME=/var/www
LANG=C.UTF-8
QUERY_STRING=
HTTP_TE=trailers
HTTP_ACCEPT_LANGUAGE=de-DE,en-US;q=0.7,en;q=0.3
DOCUMENT_URI=/
INVOCATION_ID=c38ca46505de465a86d38a3900c8c4ad
HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
REMOTE_PORT=47900
HTTP_HOST=my.domain.com
USER=www-data
SERVER_ADDR=85.17.18.15
HTTP_AUTHORIZATION=Basic dG9yc3RlbmRpZXRlcjM5MzpwZVVnJUdEN3RUJjRYZjM4
HTTP_USER_AGENT=Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0
SHLVL=1
CONTENT_LENGTH=
SERVER_PROTOCOL=HTTP/2.0
SERVER_PORT=443
SCRIPT_FILENAME=/var/www/htdocs/cgit/debug.cgi
JOURNAL_STREAM=9:39445051
REMOTE_ADDR=87.176.40.180
DAEMON_OPTS=-f
HTTP_CACHE_CONTROL=max-age=0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CONTENT_TYPE=
REQUEST_METHOD=GET
_=/usr/bin/printenv

so that's for the root url of https://my.domain.com with the debug script (url domain changed for obfuscating reasons).

> It does seem like a problem when calling the CGI script. Perhaps you
> could debug what cgit is getting from your NGINX?
>
> You could try creating a new file `/var/www/htdocs/cgit/debug.cgi` with
> the contents:
>
>     #!/bin/bash
>     echo "Content-Type: text/plain"
>     echo ""
>     printenv
>
> What this script does is: run bash, respond with the Content-Type header
> and a plaintext body containing all the environment variables passed by
> NGINX.
>
> Give it execution permissions and owned by www-data, then point NGINX to
> that script and visit the site. Check the QUERY_STRING, PATH_INFO and
> HTTP_HOST and see if they are the correct ones. Is there something strange?
>
> --
> Ariel Costas (https://costas.dev)
> Encrypt your email -- https://emailselfdefense.org/
>   GnuPG public key -- https://costas.dev/pgp


--
Torsten Kuehnel <net_seeker@web.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-13 22:03       ` Torsten Kuehnel
@ 2021-08-14 22:10         ` Ariel Costas
  2021-08-15 19:49           ` Torsten Kuehnel
  0 siblings, 1 reply; 10+ messages in thread
From: Ariel Costas @ 2021-08-14 22:10 UTC (permalink / raw)
  To: cgit

The root path works as expected, doesn't it? Try with a subdirectory
like /repo01/, as you mentioned previously in this thread.

Also, when hiding your domain name on logs, make sure to remove IPs too,
just in case :)

-- 
Ariel Costas (https://costas.dev)
Encrypt your email -- https://emailselfdefense.org/
  GnuPG public key -- https://costas.dev/pgp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-14 22:10         ` Ariel Costas
@ 2021-08-15 19:49           ` Torsten Kuehnel
  2021-08-15 22:56             ` june
  2021-08-16 11:50             ` Ariel Costas
  0 siblings, 2 replies; 10+ messages in thread
From: Torsten Kuehnel @ 2021-08-15 19:49 UTC (permalink / raw)
  To: cgit

Here comes the output, again:

HTTP_ACCEPT_ENCODING=gzip, deflate, br
SERVER_NAME=my.domain.com
HTTPS=on
SCRIPT_NAME=/repo01/
REDIRECT_STATUS=200
GATEWAY_INTERFACE=CGI/1.1
HTTP_SEC_GPC=1
SERVER_SOFTWARE=nginx/1.14.2
PATH_INFO=/repo01/
DOCUMENT_ROOT=/var/www/htdocs/cgit
HTTP_UPGRADE_INSECURE_REQUESTS=1
PWD=/var/www/htdocs/cgit
LOGNAME=www-data
REQUEST_URI=/repo01/
PATH_TRANSLATED=/var/www/htdocs/cgit
FCGI_ROLE=RESPONDER
REQUEST_SCHEME=https
HOME=/var/www
LANG=C.UTF-8
QUERY_STRING=
HTTP_TE=trailers
HTTP_ACCEPT_LANGUAGE=de-DE,en-US;q=0.7,en;q=0.3
DOCUMENT_URI=/repo01/
INVOCATION_ID=c38ca46505de465a86d38a3900c8c4ad
HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
REMOTE_PORT=39666
HTTP_HOST=my.domain.com
USER=www-data
SERVER_ADDR=xx.xx.xx.xx
HTTP_AUTHORIZATION=Basic dG9yc3RlbmRpZXRlcjM5MzpwZVVnJUdEN3RUJjRYZjM4
HTTP_USER_AGENT=Mozilla/5.0 (X11; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0
SHLVL=1
CONTENT_LENGTH=
SERVER_PROTOCOL=HTTP/2.0
SERVER_PORT=443
SCRIPT_FILENAME=/var/www/htdocs/cgit/debug.cgi
JOURNAL_STREAM=9:39445051
REMOTE_ADDR=87.176.40.180
DAEMON_OPTS=-f
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CONTENT_TYPE=
REQUEST_METHOD=GET
_=/usr/bin/printenv

On Sat, 14 Aug 2021 22:10:22 +0000
Ariel Costas <ariel@costas.dev> wrote:

> The root path works as expected, doesn't it? Try with a subdirectory
> like /repo01/, as you mentioned previously in this thread.
>
> Also, when hiding your domain name on logs, make sure to remove IPs too,
> just in case :)
>
> --
> Ariel Costas (https://costas.dev)
> Encrypt your email -- https://emailselfdefense.org/
>   GnuPG public key -- https://costas.dev/pgp


--
Torsten Kuehnel <net_seeker@web.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-15 19:49           ` Torsten Kuehnel
@ 2021-08-15 22:56             ` june
  2021-08-16 11:50             ` Ariel Costas
  1 sibling, 0 replies; 10+ messages in thread
From: june @ 2021-08-15 22:56 UTC (permalink / raw)
  To: Torsten Kuehnel; +Cc: cgit

> On Aug 15, 2021, at 15:49, Torsten Kuehnel <net_seeker@web.de> wrote:
> 
> Here comes the output, again:
> 
> HTTP_ACCEPT_ENCODING=gzip, deflate, br
> SERVER_NAME=my.domain.com
> HTTPS=on
> SCRIPT_NAME=/repo01/

I think you want SCRIPT_NAME to still be /.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cannot get cgit display anything except the repo listing page
  2021-08-15 19:49           ` Torsten Kuehnel
  2021-08-15 22:56             ` june
@ 2021-08-16 11:50             ` Ariel Costas
  1 sibling, 0 replies; 10+ messages in thread
From: Ariel Costas @ 2021-08-16 11:50 UTC (permalink / raw)
  To: Torsten Kuehnel; +Cc: cgit

This is weird, in both cases SCRIPT_FILENAME is set to the same CGI
script, and according to fcgiwrap's readme, it should use that to use
the document, and cgit to render the correct page with PATH_INFO.

-- 
Ariel Costas (https://costas.dev)
Encrypt your email -- https://emailselfdefense.org/
  GnuPG public key -- https://costas.dev/pgp

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-08-16 11:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13  7:12 cannot get cgit display anything except the repo listing page Torsten Kuehnel
2021-08-13 11:33 ` Ariel Costas
2021-08-13 20:39   ` Torsten Kuehnel
2021-08-13 21:24     ` Ariel Costas
2021-08-13 22:03       ` Torsten Kuehnel
2021-08-14 22:10         ` Ariel Costas
2021-08-15 19:49           ` Torsten Kuehnel
2021-08-15 22:56             ` june
2021-08-16 11:50             ` Ariel Costas
2021-08-13 21:22 ` Torsten Kuehnel

List for cgit developers and users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/cgit

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 cgit cgit/ https://inbox.vuxu.org/cgit \
		cgit@lists.zx2c4.com
	public-inbox-index cgit

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.cgit


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git