mirror of
https://github.com/YGGverse/next.git
synced 2026-03-31 09:45:29 +00:00
3.7 KiB
3.7 KiB
next
PHP 8 server for smallweb protocols
Based on Ratchet asynchronous socket library
Features
- Async socket
- Multi-host
- Multi-protocol:
- Multi-mode:
- Static file hosting
- optional filesystem navigation on directory request
- optional
gemfeedfile modification date - unicode filenames support
- filter hidden context (started with dot)
- sort order settings (currently dir first, asc)
- optional
- custom index file name
- custom failure template
- custom data directory location
- optional filesystem navigation on directory request
- Dynamic application
- Reverse proxy
- Static file hosting
- Connection event log
- Simple and flexible server configuration by CLI arguments
Install
Environment
apt install git composer php-fpm php-mbstring
Stable
Project under development, use repository version!
Repository
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, server 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
Startup example
php src/server.php type=nex host=127.0.0.1 port=1900 root=/target/dir
hostandport- optional arguments, read Arguments documentation for details!
Arguments
Default argument values are depending of server protocol selected
Some arguments also defined in default.json - do not change it without understanding, use CLI instead!
CLI
Provide arguments in key=value format, separated by space
Required
type- server protocol, also auto-defines defaultport, supported options:nex- NEX Protocol
root- absolute path to the public directory, where browser navigation starting from
Optional
mode- server implementation variant,fs(filesystem) by defaultfs- static files hosting for therootlocation
host- default is127.0.0.1e.g.localhostconnections onlyport- default value depends of servertypeselected, for example1900fornexor1965forgeminifile- index file name that server try to open on directory path requested, disabled by defaultlist- show content listing in the requested directory (when indexfilenot found), enabled by defaultdate- show file modification date as the alt text in directory listing (useful for gemfeed), disabled by defaultfail- absolute path to the failure template (e.g./path/to/error.gmi), disabled by defaultdump-enableordisableserver debug feature, 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