IMGUPD(8) - System Manager’s Manual

NAME

imgupd - simple image hosting service

SYNOPSIS

imgupd [-fqv] [-d database-path] [-t theme-directory]

DESCRIPTION

The imgupd utility is a simple CGI or FastCGI program to host temporary images over a web interface. It will show most recent uploaded images and let users to create new one from a web form.

It supports:

To store images, imgupd uses a SQLite database that must be writable by the CGI/FastCGI owner. See usage below.

Available options:

-f

Starts as FastCGI mode, imgupd will wait forever for new requests.

-d database-path

Specify an alternate path for the database.

-t theme-directory

Specify an alternate directory for the theme.

-q

Do not log through syslog at all.

-v

Increase verbosity level.

USAGE

The imgupd utility does not use configuration file as it does not need many adjustments, instead every parameter could be passed by environment variables or options.

By default, imgupd will try to use /usr/local/var/imgup/imgup.db database.

LOGS

The imgupd utility will log information through syslog unless verbosity is disabled. Except at startup where the tool can write to stderr some information if it can’t continue processing, the tool will never write anything to stdout and use syslog only.

The available verbosity level is defined in the following order:

none < warnings (default) < info < debug

Use -q or IMGUPD_VERBOSITY=0 if you want to disable syslog completely.

USING WITH FASTCGI

The recommended way to use imgupd is to deploy using FastCGI. You can use the kfcgi(8) helper to spawn the process for you.

Example:

kfcgi -p /var/www/imgup -- imgupd -f -d imgup.db -t siimple

Note: kfcgi chroot to the directory given, you must either statically link imgupd at build time or deploy all required libraries. Also, themes directory will need to be available in the chroot directory. In the above example, this will effectively create a database /var/www/imgup/imgup.db and use the theme /var/www/imgup/siimple.

Then, simply copy the desired theme into the directory.

cp -R /usr/local/share/imgup/themes/siimple /var/www/imgup

As an insecure alternative, you can chroot to / to avoid static-linking and copying themes, using:

kfcgi -p / -- imgupd -f \
    -d /var/www/imgup/imgup.db \
    -t /usr/local/share/imgup/themes/siimple

Both kfcgi invocations will create /var/www/run/http.sock with current user and group. Configure the web server to talk to that socket and make sure it has appropriate file permissions otherwise see -u option in kfcgi. See also the kfcgi(8) manual for more information.

Next, configure the web server.

Warning: at this moment, imgupd requires its own virtual host and can not use a url.

Server: nginx

The nginx web server requires several parameters to run imgupd.

server {
    server_name mypaste.fr;
    listen 80;

    location / {
        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 SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME       $fastcgi_script_name;
        fastcgi_param PATH_INFO         $document_uri;
        fastcgi_param PATH_TRANSLATED   $document_root$fastcgi_path_info;
        fastcgi_param REQUEST_URI       $request_uri;
        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 HTTPS             $https;
        fastcgi_pass unix:/var/www/run/httpd.sock;
    }
}

ENVIRONMENT

The following environment variables are detected:

IMGUPD_DATABASE_PATH (string)

Path to the SQLite database.

IMGUPD_THEME_DIR (string)

Directory containing the theme.

IMGUPD_VERBOSITY (number)

Verbosity level, 0 to disable completely.

AUTHORS

imgupd was written by David Demelier <markand@malikania.fr>

SEE ALSO

imgup(1), kfcgi(8)

macOS 11.2 - 25 November, 2020