eapl-gemugemi
2 years ago
5 changed files with 168 additions and 73 deletions
@ -0,0 +1,71 @@ |
|||||||
|
# Gemini-PHP |
||||||
|
Gemini-PHP is a Gemini server written in PHP by @neil@glasgow.social. |
||||||
|
It's designed more for teaching than practical use. That's said - it's very simple to get up and running and we're hosting this page on it - it seems to be performing well. |
||||||
|
If you have any questions or want to get in touch, you can join our community on Matrix at #gemini-php:glasgow.social |
||||||
|
|
||||||
|
## How to install |
||||||
|
* Download via git |
||||||
|
``` |
||||||
|
git clone https://coding.openguide.co.uk/git/gemini-php/ |
||||||
|
``` |
||||||
|
|
||||||
|
* Enter the project directory and create a certificate for your server (a self signed certificate is fine, in fact it's encouraged!) |
||||||
|
``` |
||||||
|
cd gemini-php |
||||||
|
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 |
||||||
|
``` |
||||||
|
* Combine your private key with the certificate and put in the certs directory |
||||||
|
|
||||||
|
``` |
||||||
|
cp cert.pem certs/combined.pem |
||||||
|
cat key.pem >> certs/combined.pem |
||||||
|
``` |
||||||
|
* Create a config file from the sample |
||||||
|
``` |
||||||
|
cp config.php.sample config.php |
||||||
|
``` |
||||||
|
* Then edit it with the location of your new certificate - most other options are optional |
||||||
|
* Start your server with |
||||||
|
``` |
||||||
|
php server.php |
||||||
|
``` |
||||||
|
* You should be able to visit your new server in any Gemini client (remember to open your firewall if needed - post 1965) |
||||||
|
|
||||||
|
## Using Gemini-PHP |
||||||
|
* The basic index file is located in hosts/default/index.gemini - edit this to get started |
||||||
|
* Gemini-PHP supports multiple virtual hosts, just create a directory with the name of the domain you expect to receive requests for, i.e. |
||||||
|
``` |
||||||
|
mkdir hosts/glasgow.social |
||||||
|
mkdir hosts/projects.glasgow.social |
||||||
|
``` |
||||||
|
|
||||||
|
## Running as a service |
||||||
|
To set up the server as a service, create the following file in /etc/systemd/system/gemini-php.service |
||||||
|
``` |
||||||
|
[Unit] |
||||||
|
Description=Gemini-PHP Service |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=gemini |
||||||
|
Type=simple |
||||||
|
TimeoutSec=0 |
||||||
|
WorkingDirectory=/home/gemini/gemini-php/ |
||||||
|
PIDFile=/var/run/gemini-php.pid |
||||||
|
ExecStart=/usr/bin/php -f /home/gemini/gemini-php/server.php |
||||||
|
KillMode=process |
||||||
|
|
||||||
|
Restart=on-failure |
||||||
|
RestartSec=42s |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=default.target |
||||||
|
``` |
||||||
|
Note, customise the above to the user you are running gemini-php as (we recommend creating a new user account for this to keep it relatively isolated) as well as the path to the script. |
||||||
|
Enable the script with systemctl |
||||||
|
``` |
||||||
|
sudo systemctl enable gemini-php |
||||||
|
sudo systemctl start gemini-php |
||||||
|
systemctl status gemini-php |
||||||
|
|
||||||
|
sudo systemctl stop gemini-php |
||||||
|
``` |
@ -1,15 +0,0 @@ |
|||||||
# Success! |
|
||||||
Your Gemini server is up and running! |
|
||||||
|
|
||||||
You can read more about this server at |
|
||||||
=> gemini://glasgow.social/gemini-php |
|
||||||
|
|
||||||
Join the community on Matrix at #gemini-php:glasgow.social |
|
||||||
|
|
||||||
## Getting Started |
|
||||||
Let's take 'gemini.com' as an example. |
|
||||||
* Generate a certificate and place it in the 'certs' directory named gemini.com.pem |
|
||||||
* Create a directory to server files from in the 'hosts' directory named gemini.com (e.g. mkdir hosts/gemini.com) |
|
||||||
* A file called index.gemini will be served if you haven't specified a path (this file is located at hosts/default/index.gemini) |
|
||||||
|
|
||||||
=> natalie.jpg |
|
Loading…
Reference in new issue