Hi,
I was trying to set up man.cgi to view my manual pages online and
haven't been able to find a lot of documentation for setting it up.
I managed to get the main page to load but its not able to show any
man pages, only the front page.

I am on Gentoo and am using the nginx webserver.

I amĀ  using the fcgiwrap for passing to man.cgi.
As man.cgi wants the /man folder to be present and nginx doesnt have chroot
I had to symlink my /var/www/man to /man (as a temporary work around).

the folder /man contains a single file - manpath.conf with just a single line - system

the /man/system directory contains man1/ man2/ ... folders with the man pages in them.

But when I go to http://localhost , while I can see the main page, clicking on
any of the links man.cgi(8) or apropos(1) just shows the same page.

Can anyone point out what I am missing.

nginx.conf:
user nginx nginx;
worker_processes 1;

error_log /var/log/nginx/error_log info;

events {
	worker_connections 1024;
	use epoll;
}

http {
	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	log_format main
		'$remote_addr - $remote_user [$time_local] '
		'"$request" $status $bytes_sent '
		'"$http_referer" "$http_user_agent" '
		'"$gzip_ratio"';

	client_header_timeout 10m;
	client_body_timeout 10m;
	send_timeout 10m;

	connection_pool_size 256;
	client_header_buffer_size 1k;
	large_client_header_buffers 4 2k;
	request_pool_size 4k;

	gzip off;

	output_buffers 1 32k;
	postpone_output 1460;

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;

	keepalive_timeout 75 20;

	ignore_invalid_headers on;

        server {
		server_name localhost;
		listen 127.0.0.1;

		location / {
			include fastcgi_params;
			fastcgi_pass 127.0.0.1:12345;
			fastcgi_param  SCRIPT_FILENAME /var/www/cgi-bin/man.cgi;
		}
	}
}


fcgiwrap init script:
#!/sbin/openrc-run

ip="0.0.0.0"
port="12345"

start() {
	ebegin "Starting fcgiwrap process..."
	/usr/sbin/fcgiwrap -s tcp:$ip:$port &
	tcp_sock=`netstat -tulpn | grep fcgiwrap`
	eend $? "Errors were encountered while starting fcgiwrap process"
}

stop() {
	ebegin "Stopping fcgiwrap process..."
	pid=`ps a | grep fcgiwrap | grep tcp | cut -d" " -f1`
	kill -s 1 $pid
	tcp_sock=`netstat -tulpn | grep fcgiwrap`
	if test $tcp_sock =  2> /dev/null ; then
		echo "Fcgiwrap process successfully stoped"
		tcp_sock=`netstat -atulpn | grep $port`
		if test $tcp_sock =  2> /dev/null ; then
			echo "No open fcgiwrap connection found..."
		else
			echo "Wait to close fcgiwrap open connections...please verify with 'status'"
			echo -e "Socket details: \n$tcp_sock"
		fi
	else
		echo "Fcgiwarp process is still running!"
		echo "Socket details: $tcp_sock"
        fi
	eend $? "Errors were encountered while stopping fcgiwrap process..."
}

status() {
	ebegin "Status fcgiwrap process..."
	tcp_sock=`netstat -atulpn | grep $port`
	if test $tcp_sock =  2> /dev/null ; then
		echo "Fcgiwrap process not running"
	else
		echo "Fcgiwarp process is running!"
		echo -e "Socket details: \n$tcp_sock"
	fi
	eend $? "Errors were encountered while stopping fcgiwrap process..."
}