PHP 8 server for different protocols
Based on Ratchet asynchronous socket library
- Async socket
- Multi-host
- Multi-protocol:
- Multi-mode:
- Static file hosting
- filesystem navigation on directory request
- optional
gemfeed
file 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
- filesystem navigation on directory request
- KevaCoin storage browser
- Custom application
- Reverse proxy
- Stream server
- Static file hosting
- Connection event log
- Simple and flexible server configuration by CLI arguments
apt install git composer php-fpm php-mbstring
- for
kevacoin
servermode
, also requiredphp-curl
extension
Project under development, use repository version!
git clone https://github.com/YGGverse/next.git
cd next
- navigate into the project directorycomposer update
- grab latest dependencies
Create as many servers as wanted by providing different type
, host
, port
, type
, mode
and other arguments!
- for security reasons, file server prevents any access to the hidden files (started with dot)
- also, clients can't access any data out the
root
path, that defined on server startup
php src/server.php host=127.0.0.1 port=1900 type=nex mode=fs root=/target/dir
host
andport
- optional arguments, read Arguments documentation for details!
Optional arguments auto-defined by server protocol type
selected
Some arguments also defined in default.json - do not change it without understanding, use CLI instead!
Provide arguments in key=value
format, separated by space
Children nodes dependent of parent arguments defined and would be skipped in other combinations!
Following list explains key
dependencies and it value
options (started with =
)
type
- required, server protocol, also auto-defines defaultport
, supported options:- =
nex
- NEX Protocolmode
- optional, server implementation variant,fs
(filesystem) by default- =
fs
- static files hosting for theroot
locationroot
- absolute path to the public directory, where browser navigation starting fromfile
- file name that server try to open on directory path requested, disabled by defaultlist
- show listing in directory requested (on indexfile
not found), enabled by defaultdate
- show file modification date (as gemfeed) in directory listing, disabled by default
- =
kevacoin
- KevaCoin storage browser by RPC connection to the wallet (seekevacoin.conf
)rpcscheme
- required, for examplehttp
rpcport
- required, default is9992
rpchost
- required, remote orlocalhost
rpcuser
- requiredrpcpassword
- requirednamespace
- required, remote or local namespace for data listing (started withN
)
- =
- =
host
- optional, default is127.0.0.1
e.g.localhost
connections onlyport
- optional, default value depends of servertype
selected e.g.1900
fornex
or1965
forgemini
fail
- optional, absolute path to the failure template (e.g./path/to/error.gmi
), disabled by defaultdump
- optional,enable
ordisable
server debug feature, enabled by default
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 mode=fs 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