blob: f9bb22af3ac84d3a66bd23da6a5e3d6aa2037950 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<?php
use GeminiFoundation\Server;
use GeminiFoundation\Server\RequestHandlers\DocumentServer;
require __DIR__ . '/vendor/autoload.php';
$server = new Server(
[
'file' => __DIR__ . '/certificate/cert.pem',
'key' => __DIR__ . '/certificate/key.rsa',
'passphrase' => '',
],
'0.0.0.0'
);
$server->onRequest(new DocumentServer(
documentRoot: realpath($_ENV['SERVER_DOCUMENT_ROOT'] ?? './content'),
indexFile: $_ENV['SERVER_INDEX_FILE'] ?? 'index.gmi',
useDirectoryListing: boolval($_ENV['SERVER_USE_DIRECTORY_LISTING'] ?? false)
));
$server->listen();
|