mirror of
https://github.com/YGGverse/next.git
synced 2026-03-31 17:55:34 +00:00
2.5 KiB
2.5 KiB
next
PHP 8 server for different protocols
Based on Ratchet asynchronous socket library.
Features
- Asynchronous connections
- Multi-host
- Multi-protocol:
- Event log
- Optional:
- directory listing navigation with safe filesystem access
- custom index file names
- custom failure page
- Flexible server configuration by environment arguments
Install
git clone https://github.com/YGGverse/next.gitcd next- navigate into the project directorycomposer update- grab latest dependencies
Launch
Start
Create as many servers as wanted by providing different type, host, port and other arguments!
- for security reasons,
nextserver prevents any access to the hidden files (started with dot) - also, clients can't access any data out the
rootpath, that defined on server startup
Simple example:
php src/server.php type=nex host=127.0.0.1 port=1900 root=/target/dir
hostandportis optional, read arguments documentation for details!
Arguments
Required
type- server protocol, supported options:nex- NEX Protocol
root- absolute path to the public directory
Optional
host-127.0.0.1by defaultport- depends of servertypeby defaultfile- index file name that server try to open on directory path requested, disabled by defaultlist- show content listing in the requested directory (when index file not found), enabled by defaulttime- show file modification time as the alt text in directory listing, disabled by defaultfail- absolute path to the failure template (e.g./path/to/error.gmi), disabled by defaultdump- query log, enabled by default
Autostart
systemd
Following example mean you have next server installed into home directory of next user (useradd -m next)
# /etc/systemd/system/next.service
[Unit]
After=network.target
[Service]
Type=simple
User=next
Group=next
ExecStart=/usr/bin/php /home/next/next/src/server.php type=nex root=/home/next/public
StandardOutput=file:/home/next/debug.log
StandardError=file:/home/next/error.log
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl daemon-reload- reload systemd configurationsystemctl enable next- enable service on system startupsystemctl start next- start server