uHTML binding with PSGI for Plack

General Overview

This perl program provides the necessary executable to bind uHTML with Plack using the PSGI interface. It works well with the perl FCGI server and nginx. This documentation refers to the version 1.0 of the uHTML::psgi program.

To install this program, copy it into the uHTML subdirectory of a perl-library directory.

Terms of Use

It is allowed to use this library under the actual GNU Lesser General Public License. The name of this library and it's author is to be named in all derivations.


This uHTML::psgi program requires the uHTML::request library.

Invocation Example

The Plack PSGI server is started with plackup -s FCGI -S /tmp/uHTML -a /usr/lib/perl/*/uHTML/psgi. In the nginx configuration a section redirecting uHTML requests to the plackup server is needed:

server.conflocation ~ \.uhtml$
  try_files $uri /index.uhtml =404 ;

  fastcgi_keep_conn on ;
  fastcgi_split_path_info ^()(.*uhtml)$;

  fastcgi_pass   unix:/tmp/uHTML ;
  fastcgi_index  index.uhtml;

  fastcgi_param  URI                  $uri;
  fastcgi_param  SCRIPT_FILENAME
  fastcgi_param  SCRIPT_NAME          $fastcgi_script_name;
  fastcgi_param  PATH_TRANSLATED
  fastcgi_param  QUERY_STRING         $query_string;
  fastcgi_param  REQUEST_METHOD       $request_method;
  fastcgi_param  CONTENT_TYPE         $content_type;
  fastcgi_param  CONTENT_LENGTH       $content_length;
  fastcgi_param  REQUEST_URI          $request_uri;
  fastcgi_param  REQUEST              $request;
  fastcgi_param  REQUEST_SCHEME       $scheme ;
  fastcgi_param  REQUEST_FILE         $request_filename;
  fastcgi_param  DOCUMENT_URI         $document_uri;
  fastcgi_param  DOCUMENT_ROOT        $document_root;
  fastcgi_param  SERVER_PROTOCOL      $server_protocol;
  fastcgi_param  GATEWAY_INTERFACE    CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE      nginx/$nginx_version;
  fastcgi_param  REMOTE_ADDR          $remote_addr;
  fastcgi_param  REMOTE_PORT          $remote_port;
  fastcgi_param  SERVER_ADDR          $server_addr;
  fastcgi_param  SERVER_PORT          $server_port;
  fastcgi_param  SERVER_NAME          $server_name;
  fastcgi_param  HOST_NAME            $hostname;
  fastcgi_param  HTTPS                $https;
  fastcgi_param  HTTP_COOKIE          $http_cookie;
  fastcgi_param  HTTP_ACCEPT_LANGUAGE $http_accept_language;
  fastcgi_param  REDIRECT_STATUS      200;
  fastcgi_param  SCRIPT_ROOT          /srv/cgi-bin ;
  fastcgi_param  DATA_ROOT            /srv/cgi-bin ;

location /

See as well the uHTML description and the documentation provided with the program.