tabuna/stone is a Laravel package for laravel stone - http server using the reactphp.
It currently has 0 GitHub stars and 7 downloads on Packagist (latest version 0.0.1).
Install it with composer require tabuna/stone.
Discover more Laravel packages by tabuna
or browse all Laravel packages to compare alternatives.
Last updated
With ReactPHP we keep our application alive between requests so we only execute this bootstrap once when starting the server: the footprint is absent from Requests. However now the tables are turned: we're vulnerable to memory consumption, fatal error, statefulness and code update worries.
Installer using Composer:
$ composer require tabuna/stone
The easiest way to run:
$ php vendor/bin/stone
You can also specify a port:
$ php vendor/bin/stone -p 8000
It does not interfere with your application, so do not worry
Install Supervisord
$ sudo apt-get install -y supervisor
Here's a configuration example (create a *.conf file in /etc/supervisord/conf.d):
[program:laravel-stone-server]
command=php /path/to/your/code/vendor/bin/stone -p 800%(process_num)
process_name=%(program_name)s-%(process_num)d
numprocs=4
umask=022
user=foobar
stdout_logfile=/var/log/supervisord/%(program_name)s-%(process_num)d.log ; stdout log path, NONE for none; default AUTO
stderr_logfile=/var/log/supervisord/%(program_name)s-%(process_num)d-error.log ; stderr log path, NONE for none; default AUTO
autostart=true
autorestart=true
startretries=3
It will:
What we do here is to proxy only requests that don’t point to a local file.
upstream stone {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
server {
listen 80;
server_name example.com;
root /example.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
proxy_pass http://stone;
break;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
If you would like to support development by making a donation you can do so here. 😊
The MIT License (MIT). Please see License File for more information.