stargazer.ini(5)
π stargazer.ini(5) β File Formats Manual π
okay bestie so this is stargazer.ini(5), the manual for the config file of stargazer(1). yes it's called a "File Formats Manual" and yes that's very serious of it β¨
πΈ NAME πΈ
stargazer.ini β the configuration file for stargazer(1). that's it. that's the whole name section π
π¦ EXAMPLE CONFIG π¦
okay so here's what a real one looks like, and honestly? it's giving main character energy. copy it, adapt it, live your truth:
listen = 0.0.0.0
[:tls]
store = /var/lib/gemini/certs
organiztion = example org
[example.com]
root = /srv/gemini/example.com
[example.com~(.*).cgi(.*)]
root = /srv/gemini/example.com/cgi-bin
cgi = on
(and yes, organiztion is spelled like that in the original. do not come for me, I am simply the messenger π)
π«Ά also! a default config file should also be installed at /etc/stargazer.ini β so if you're ever lost, that's your safe space.
β¨ SYNTAX β¨
okay so stargazer.ini is an INI file. periodt. that means every single line is either:
- a key/value pair, or
- a section heading
and that's the whole vibe check π
key/value pairs are written as key=value. sections are written as [section]. that's the β¨entireβ¨ format, she's simple, she's iconic.
- extra white space is generally ignored, so you can space things out however feels right β no need to be weird about it π
booleans, bestie, listen: you can write them as true/false, on/off, or yes/no π₯ and they're case insensitive, so ON, On, and oN are all literally the same thing. go off. slay. π
(more to come, bestie β this was only part one π)
π CONFIGURATION KEYS π
Okay so the meaning of a key lowkey depends on which section it's chillin' in, bestie. Anonymous keys β meaning the ones that show up prior to the first [section] directive β are used to specify parameters for the daemon itself. Sections whose name is prefixed with :, e.g. [:tls], are sub-categories of the daemon configuration. Otherwise, section names refer to the hostnames of domains serviced by the stargazer daemon. Each of these sections is a route that stargazer will serve requests to, and at least one route must be specified, periodt.
π ANONYMOUS KEYS π
listenβ A space-separated list of addresses that the daemon shall bind to. Each address shall take the formataddress:port. If:portis omitted,1965(the default Gemini port) is presumed. To specify an IPv6 address, enclose it in[], e.g.[::]. Note that IPv6 listeners always haveIPV6_V6ONLYset, so they will only listen on the IPv6 interface and not also IPv4. If you wish to listen on both, specify both. Stargazer supports listening on multiple interfaces/ports but does not support serving different content on different interfaces/ports. It does support serving different content on different domains and paths.connection-loggingβ Whether or not to log connections tostdout. Disabling this may increase performance. On by default. Always on if thedebugcli flag is on.log-ipβ Log client IP addresses in the connection log. Mutually exclusive withlog-ip-partial. Off by default.log-ip-partialβ Log partial client IP addresses in the connection log. For IPv4 addresses only the first 2 octets are logged, the rest are zeroed. For IPv6 addresses only the first 3 16bit segments are logged, the rest are zeroed. May be preferable tolog-ipto help maintain user privacy. Mutually exclusive withlog-ip-partial(yes, the page says that here too β direct quote, no cap). Off by default.request-timeoutβ Number of seconds to wait for the client to send a complete request. If the timeout is exceeded,stargazerwill send59 Request timeoutand close the connection. 5 seconds by default. Set to0to disable.response-timeoutβ Number of seconds to wait for the client to send a complete request and forstargazerto finish sending the response. If the timeout is exceeded,stargazerwill send and close the connection. Disabled by default (the page literally says βby default defaultβ β keeping the lore).
β οΈ Warning: if this is set, large files and cgi scripts may be cut off before their response finishes.
proxy-protocolβ Whether or not to expect a proxy protocol header before the tls connection. It is generally used with a reverse proxy in situations where you need to know the real IP address of the client. Off by default.
See the formal specification of proxy protocol:
http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
π¦ TLS KEYS π¦
The following keys are accepted under the [:tls] section:
storeβ Path to the certificate store on disk. This should be a persistent directory writable by the daemon. The daemon manages its own certificates β no user intervention is required, except in the case of moving the daemon to another host, in which case the certificate store must be copied to the new host.organizationβ An optional key used during certificate generation. Fill this in with the name of the organization responsible for the host and it will be filled in as theX.509 /Oname.gen-certsβ Set tofalseto turn off automatic certificate generation.regen-certsβ Set tofalseto turn off automatic regeneration of expired certificates.cert-lifetimeβ Set how long auto-generated certs last before expiring. Specified as a number followed byyfor a number of years,mfor a number of months (a month being 30 days), ordfor a number days. Ex.5yfor 5 years or30dfor 30 days.
π ROUTING KEYS π
To configure stargazer to service requests, routing keys must be defined. The name of the configuration section is used to determine what kinds of requests it configures.
The format of the section name is the hostname to be serviced, followed by a token which defines the routing strategy, and a string whose format is specific to each routing strategy. The token and match string may be omitted (i.e. [hostname] alone), which implies path routing against "/". A port may not be specified along with the hostname. Stargazer does not support serving different content on different ports.
:β Route by path prefix. The URL path is compared to"string/".=β Exact match. The URL path must exactly match the string.~β Regular expression routing. The string is a Rust-compatible regular expression which is tested against the URL path.
See the docs for the syntax section of the docs for the regex rust crate for a definition of the regular expression syntax and features:
https://docs.rs/regex/1.4.2/regex/#syntax
Some example section names and examples of matching paths:
[example.org:/foo] /foo, /foo/bar, /foo/bar/baz
[example.org=/foo.txt] /foo.txt
[example.org~/[a- /foo.png, /bar.webp
z]+\.(png|jpg|webp)]
(That line wrap is exactly how it appears in the page β not me, bestie.)
Routes should be ordered from least to most specific. The matching algorithm attempts to match the URL against each route in reverse order, and chooses the first route which matches.
Within each routing section, the following keys are used to configure how stargazer will respond to matching requests:
rootβ Configures the path on disk from which files shall be served for this host. The path component of the URL will be appended to this value to form the path to files on disk to serve.
If example.org/foo/bar.txt is requested, and a route is configured for [example.org:/foo] with the root set to /srv/gemini, /srv/gemini/foo/bar.txt will be served.
rewriteβ If regular expression routing is used, therewritedirective may be used to rewrite the URL path component before proceeding. The URL will be set to the value of the rewrite expression. If\Nappears in the rewrite value, whereNis a number, that capture group will be substituted for\N. If\{name}appears, wherenameis a named capture group, it will be substituted. Capture group 0 refers to the entire matched path.
Example:
[localhost~^/([a-zA-Z]+)\.(?P<extension>png|jpg)$]
root=./root
rewrite=/images/\1.\{extension}
This will rewrite a request for /example.png to /images/example.png. This directive will also modify the path of a redirect URL if used in a redirect route.
indexβ Configures the name of the index file which shall be served in the event that a request for this host does not include the filename part. Defaults to"index.gmi".auto-indexβ"on"to enable the auto-index feature, which presents clients with a list of files in the requested directory when an index file cannot be found. Off by default. Only available for static file routes.langβ Set this value as thelangparameter for gemini files served under this route. Thelangparam will only be set fortext/geminiresponses. The Gemini Specification says that thelangparameter should contain a comma separated list of language identifier from RFC 4646. Stargazer will use thelangparameter as given in this config. It is up to the user to provide a valid list of languages. Currently, this parameter is only used when serving static files.charsetβ Set this value as thecharsetparameter for text files served under this route. Thelangparam will only be set fortext/*responses. If thelangparameter is also set, thenlangwill be set instead ofcharsetfortext/geminiresponses. The Gemini Specification says that thecharsetparameter should be a character set specified in RFC 2046. Stargazer will use thecharsetparameter as given in this config. It is up to the user to provide a valid charset value. Currently, this parameter is only used when serving static files.mime-overrideβ Override the MIME type of all files served under this route with the specified value. This parameter can only be used when serving static files. This can be used with an exact match route to override the MIME type for a single file.redirectβ Send a redirect to this URI instead of serving other content. The URI exactly as written will be sent to the client. Mutually exclusive with most other settings.permanentβ Send a permanent redirect instead of a temporary redirect. Requiresredirectto be set.cgiβ"on"to enable CGI support.rootmust also be configured. See βCGI Supportβ for details. Mutually exclusive withauto-index.cgi-userβ Run CGI process as this user and their primary group. Set to the name of the user. Otherwise process is run as same user asstargazer, which can be a security issue if the CGI process is untrusted (not that running untrusted CGI processes is a good idea to begin with). The userstargazeris run as must be able to setuid the child process to the user specified.scgiβ"on"to enable SCGI support.scgi-addressmust also be set. See βSCGI Supportβ for details.root,index, andauto-indexnot allowed whenscgiis on.scgi-addressβ The address of the SCGI server to connect to. If this is a valid file system path that exists,stargazerwill connect to a Unix domain socket at that path to send requests. Otherwise the address value will be treated as a socket address and requests will be made over TCP.cgi-timeoutβ Maximum amount of time a CGI/SCGI process on this route is allowed to run. If the timeout is exceeded,stargazerwill send a CGI error to the client and either kill the CGI process or close the SCGI connection. Values is a whole number of seconds. By default CGI processes have no timeout andstargazerwill wait indefinitely for them to finish.cert-pathβ Path to this certificate for this route, overrides the default store path. This is intended to be used for certs not managed bystargazer. As suchstargazerwill not attempt to generate or regenerate these certs. If this is set,key-pathmust also be set.key-pathβ Path to the key that goes with the cert set by thecert-path. If this is set,cert-pathmust also be set.client-certβ Path to a client certificate that the client must use to access this route. Only one client certificate may be specified per route. Client certificate must be in the PEM format.
π CGI Support π
okay so stargazer supports a limited version of CGI, and it's compatible with the Jetforce server. It is not a faithful implementation of RFC 3875, but it's enough for most of the needs of Gemini servers. slay.
Set cgi=on in a route configuration to enable CGI for that route, and set root to the path where the CGI scripts are found. If a client requests a script, it will be executed, and it must print a Gemini response (including status code and meta) to stdout. no cap.
If a CGI process exceeded the timeout set by cgi-timeout, or if the connection to the client is lost and the CGI process is still running, it will be killed. On *nix systems, the CGI process will receive SIGTERM. If it is still running after 3 seconds it will receive SIGKILL. On other systems (i.e. Windows) the CGI process will just be killed. If cgi-timeout is exceeded, stargazer will send a CGI error message to the gemini client before closing the connection.
The following environment variables will be set:
GATEWAY_INTERFACEβ example:CGI/1.1β CGI versionSERVER_PROTOCOLβ example:GEMINIβ The server protocolSERVER_SOFTWAREβ example:stargazer/0.1.0β The stargazer server name and versionGEMINI_URLβ example: See [1] β The URL requested by the clientSCRIPT_NAMEβ example:/cgi-bin/foo.shβ The portion of the URL referring to the script name.PATH_INFOβ example:/barβ The remainder of the path followingSCRIPT_NAME.QUERY_STRINGβ example:hello=worldβ The query string portion of the URL. [3]SERVER_NAME,HOSTNAMEβ example:example.orgβ The server host name.SERVER_PORTβ example:1965β The server port number.REMOTE_HOST,REMOTE_ADDRβ example:10.10.0.2β The client's IP address.TLS_CLIENT_HASHβ example: See [2] β A fingerprint that can be used to uniquely identify the cert.TLS_CLIENT_NOT_BEFOREβ example:2020-10-22T04:31:40Zβ The date the client's cert is not valid before. See [4].TLS_CLIENT_NOT_AFTERβ example:2021-10-22T04:31:59Zβ The date the client's cert is not valid after. See [4].REMOTE_USERβ example:"My cert"β The client cert's issuer field.
Footnotes, bestie:
[1]:gemini://example.org/cgi-bin/foo.sh/bar?hello=world[2]:1flC87yanv8KQ027TrvOOP/kA5yTWn3xLPJ+GxgaNB4=[3]: stargazer will attempt to percent decode the query string as UTF-8. If this fails the string will be provided as is, undecoded.[4]: Timestamps arerfc3339 complaint, exact format is unspecified.
The exit status of the script is ignored. periodt.
π SCGI Support π
stargazer has SCGI support similar to its CGI support. Set scgi=on for a route configuration to enable SCGI for that route and set scgi-address to the address of the SCGI server. The address can either be a path to a Unix Domain Socket or the TCP Socket address. The headers included in the SCGI request match the CGI parameters list above with a few exceptions.
If the SCGI server doesn't finish responding before cgi-timeout is exceeded (assuming one is set) stargazer will close the connection to the SCGI server and send a CGI error to the gemini client.
If the connection to the gemini client is lost stargazer will close the connection to the SCGI server.
New headers:
CONTENT_LENGTHβ example:0β Length in bytes of the request body. See [1].SCGIβ example:1β SCGI Version[1]: Always0since gemini doesn't have request bodies but included as it's required by the SCGI protocol.
CGI header that are omitted from SCGI:
GATEWAY_INTERFACE
π AUTHORS π
Maintained by Sashanoraa <sasha@noraa.gay>. Up-to-date sources can be found at https://sr.ht/~zethra/stargazer/ and bugs/patches can be submitted by email to ~zethra/public-inbox@lists.sr.ht with the prefix stargazer.
That's the whole vibe, bestie. This lil page is stargazer.ini(5), dated 2025-11-02. Go off and configure your server π
β¨π¦
π¦ where this page comes from
- alpine 3.24: stargazer-gmi-doc 1.3.4-r0 Β· AGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms