mirror of https://github.com/YGGverse/next.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.3 KiB
2.3 KiB
next
PHP 8 Server for NEX Protocol, based on the nex-php library
Install
git clone https://github.com/YGGverse/next.git
cd next
- navigate into the server directorycomposer update
- grab latest dependencies
NEX
Optimal to serve static files
For security reasons, next
server prevents any access to the hidden files (started with dot)
Start
Create as many servers as wanted by providing different host
and port
using optional arguments
php src/nex.php host=127.0.0.1 port=1900 path=/target/dir
Arguments
Required
path
- absolute path to the public directory
Optional
host
-127.0.0.1
by defaultport
-1900
by defaultfile
- index filename that server try to open on directory path requested, disabled by defaultlist
- show content listing in the requested directory (when index file not found),yes
by defaultfail
- filepath that contain failure text or template (e.g.error.gmi
),fail
text by defaultsize
- limit request length in bytes,1024
by defaultdump
- query log, blank to disable, default:[{time}] [{code}] {host}:{port} {path} {real} {size} bytes
{time}
- event time inc
format{code}
- formal response code:1
- found,0
- not found{host}
- peer host{port}
- peer port{path}
- path requested{real}
- realpath returned{size}
- response size in bytes
Autostart
Launch server as the systemd
service
Following example mean you have next
server installed into home directory of next
user (useradd -m next
)
mkdir /home/next/public
- make sure you have created public foldersudo nano /etc/systemd/system/next.service
- create new service:
[Unit]
After=network.target
[Service]
Type=simple
User=next
Group=next
ExecStart=/usr/bin/php /home/next/next/src/nex.php path=/home/next/public
StandardOutput=file:/home/next/debug.log
StandardError=file:/home/next/error.log
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
- reload systemd configurationsudo systemctl enable next
- enablenext
service on system startupsudo systemctl start next
- startnext
server