mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-24 05:44:17 +08:00
Merge branch 'update-server-demo' into 'master'
server-demo: Update rustysd init, update PHP See merge request redox-os/redox!1819
This commit is contained in:
commit
6ceb314c0d
@ -82,9 +82,8 @@ Description=The nginx HTTP and reverse proxy server
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/usr/bin/nginx
|
||||
TimeoutStopSec=5
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/nginx -g "daemon off;"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -99,16 +98,34 @@ Description=OpenBSD Secure Shell server
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/usr/bin/sshd
|
||||
TimeoutStopSec=5
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/sshd -D
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
"""
|
||||
|
||||
|
||||
|
||||
[[files]]
|
||||
path = "/etc/rustysd/system/php.service"
|
||||
data = """
|
||||
[Unit]
|
||||
Description=OpenBSD Secure Shell server
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# currently php-fpm not that quite work
|
||||
ExecStart=env PWD=/var/www/html php -S localhost:9000
|
||||
# ExecStart=/usr/bin/php-fpm --fpm-config /etc/php/84/php-fpm.conf --nodaemonize
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
"""
|
||||
|
||||
[[files]]
|
||||
path = "/home/user/public_html/index.php"
|
||||
path = "/var/www/html/index.php"
|
||||
data = """
|
||||
<?php
|
||||
|
||||
@ -116,14 +133,14 @@ echo "Hello from PHP on Redox!";
|
||||
"""
|
||||
|
||||
[[files]]
|
||||
path = "/home/user/public_html/phpinfo.php"
|
||||
path = "/var/www/html/phpinfo.php"
|
||||
data = """
|
||||
<?php phpinfo();
|
||||
"""
|
||||
|
||||
|
||||
[[files]]
|
||||
path = "/home/user/public_html/README"
|
||||
path = "/var/www/html/README"
|
||||
data = """
|
||||
This is a demonstration into PHP server.
|
||||
|
||||
@ -142,7 +159,9 @@ postinstall = true
|
||||
path = "/etc/nginx/nginx.conf"
|
||||
data = """
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
# currently nginx does a lot spin locking for some reason
|
||||
worker_processes 1;
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
@ -171,6 +190,7 @@ server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/website;
|
||||
absolute_redirect off;
|
||||
|
||||
location / {
|
||||
index index.html index.htm;
|
||||
@ -185,7 +205,7 @@ data = """
|
||||
server {
|
||||
listen 8081;
|
||||
server_name localhost;
|
||||
root /home/user/public_html;
|
||||
root /var/www/html;
|
||||
|
||||
index index.php index.html index.htm;
|
||||
|
||||
@ -194,10 +214,12 @@ server {
|
||||
}
|
||||
|
||||
location ~ \\.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
# because we're not using PHP FPM (see rustysd php.service)
|
||||
# include fastcgi_params;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
proxy_pass http://127.0.0.1:9000;
|
||||
}
|
||||
}
|
||||
"""
|
||||
@ -207,6 +229,7 @@ postinstall = true
|
||||
path = "/etc/php/84/php-fpm.conf"
|
||||
data = """
|
||||
|
||||
error_log=/var/log/php-fpm.log
|
||||
include=/etc/php/84/php-fpm.d/*.conf
|
||||
"""
|
||||
|
||||
@ -275,14 +298,18 @@ data = """
|
||||
# At the moment we support SSH, NGINX, Python, PHP. There's more to come
|
||||
#
|
||||
# This server demo is insecure by design, we encourage you to get familiar into
|
||||
# basics of server security if you wish to use this as a production server.
|
||||
# basics of server security if you wish to use this as a production server.
|
||||
#
|
||||
# To start the daemon, run
|
||||
# > sudo bash server.sh
|
||||
#
|
||||
# A WIP port of rustysd is available, you can try start it manually
|
||||
# There should be rustysd already running, if not, you can try start it manually
|
||||
# > sudo rustysd --conf /etc/rustysd
|
||||
#
|
||||
# The server will start port 22 (ssh), 80 (static web) and 8080 (php)
|
||||
# You can also try running all daemons manually
|
||||
# > sudo bash server.sh
|
||||
#
|
||||
# The server will start port 22 (ssh), 80 (static web) and 8081 (php)
|
||||
# If you use the Redox OS build system, starting QEMU with `net=redir`
|
||||
# should expose those port to 8022, 8080 and 8081.
|
||||
# Try logging in to console via SSH with `ssh user@localhost -p 8022`
|
||||
#
|
||||
##############################################################################
|
||||
"""
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
[source]
|
||||
tar = "https://www.php.net/distributions/php-8.4.12.tar.xz"
|
||||
tar = "https://www.php.net/distributions/php-8.4.17.tar.xz"
|
||||
blake3 = "a8478dddd948d4b26e51c5727ac0895440da76e8ad9be947098a4284ca0b7f2a"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff -ruwN source/configure source-new/configure
|
||||
--- source/configure 2025-08-26 20:36:28.000000000 +0700
|
||||
+++ source-new/configure 2025-09-26 16:31:28.871157195 +0700
|
||||
@@ -25863,7 +25863,7 @@
|
||||
--- source/configure 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/configure 2026-01-16 15:56:01.944755811 +0700
|
||||
@@ -26007,7 +26007,7 @@
|
||||
then :
|
||||
ac_cv_lib_curl_curl_easy_perform=yes
|
||||
else case e in #(
|
||||
@ -10,7 +10,7 @@ diff -ruwN source/configure source-new/configure
|
||||
esac
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
@@ -37356,7 +37356,7 @@
|
||||
@@ -37728,7 +37728,7 @@
|
||||
then :
|
||||
php_cv_lib_gd_works=yes
|
||||
else case e in #(
|
||||
@ -19,7 +19,7 @@ diff -ruwN source/configure source-new/configure
|
||||
esac
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
@@ -40056,7 +40056,7 @@
|
||||
@@ -40464,7 +40464,7 @@
|
||||
LIBS_SAVED=$LIBS
|
||||
CFLAGS="$CFLAGS $GMP_CFLAGS"
|
||||
LIBS="$LIBS $GMP_LIBS"
|
||||
@ -29,8 +29,8 @@ diff -ruwN source/configure source-new/configure
|
||||
if test "x$ac_cv_header_gmp_h" = xyes
|
||||
then :
|
||||
diff -ruwN source/ext/phar/Makefile.frag source-new/ext/phar/Makefile.frag
|
||||
--- source/ext/phar/Makefile.frag 2025-08-26 20:36:28.000000000 +0700
|
||||
+++ source-new/ext/phar/Makefile.frag 2025-09-26 16:31:29.029526842 +0700
|
||||
--- source/ext/phar/Makefile.frag 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/ext/phar/Makefile.frag 2026-01-16 15:56:01.946130660 +0700
|
||||
@@ -30,7 +30,7 @@
|
||||
-@test -f $(builddir)/phar/phar.inc || cp $(srcdir)/phar/phar.inc $(builddir)/phar/phar.inc
|
||||
|
||||
@ -41,8 +41,8 @@ diff -ruwN source/ext/phar/Makefile.frag source-new/ext/phar/Makefile.frag
|
||||
$(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH)
|
||||
-@(echo "Generating phar.php"; \
|
||||
diff -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c
|
||||
--- source/ext/posix/posix.c 2025-08-26 20:36:28.000000000 +0700
|
||||
+++ source-new/ext/posix/posix.c 2025-09-26 16:31:29.085983450 +0700
|
||||
--- source/ext/posix/posix.c 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/ext/posix/posix.c 2026-01-16 15:56:01.946290813 +0700
|
||||
@@ -375,7 +375,7 @@
|
||||
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
@ -53,25 +53,27 @@ diff -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c
|
||||
RETURN_FALSE;
|
||||
}
|
||||
diff -ruwN source/sapi/fpm/fpm/fpm_status.c source-new/sapi/fpm/fpm/fpm_status.c
|
||||
--- source/sapi/fpm/fpm/fpm_status.c 2025-08-26 20:36:28.000000000 +0700
|
||||
+++ source-new/sapi/fpm/fpm/fpm_status.c 2025-09-27 01:07:38.657514932 +0700
|
||||
@@ -104,11 +104,15 @@
|
||||
--- source/sapi/fpm/fpm/fpm_status.c 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/sapi/fpm/fpm/fpm_status.c 2026-01-16 15:57:37.781307156 +0700
|
||||
@@ -84,6 +84,7 @@
|
||||
continue;
|
||||
}
|
||||
proc_p = &procs[i];
|
||||
/* prevent NaN */
|
||||
+#ifdef HAVE_TIMES
|
||||
if (procs[i].cpu_duration.tv_sec == 0 && procs[i].cpu_duration.tv_usec == 0) {
|
||||
if (proc_p->cpu_duration.tv_sec == 0 && proc_p->cpu_duration.tv_usec == 0) {
|
||||
cpu = 0.;
|
||||
} else {
|
||||
cpu = (procs[i].last_request_cpu.tms_utime + procs[i].last_request_cpu.tms_stime + procs[i].last_request_cpu.tms_cutime + procs[i].last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() / (procs[i].cpu_duration.tv_sec + procs[i].cpu_duration.tv_usec / 1000000.) * 100.;
|
||||
@@ -91,6 +92,9 @@
|
||||
proc_p->last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() /
|
||||
(proc_p->cpu_duration.tv_sec + proc_p->cpu_duration.tv_usec / 1000000.) * 100.;
|
||||
}
|
||||
+#else
|
||||
+ cpu = 0.;
|
||||
+#endif
|
||||
|
||||
array_init(&fpm_proc_stat);
|
||||
add_assoc_long(&fpm_proc_stat, "pid", procs[i].pid);
|
||||
@@ -590,11 +594,15 @@
|
||||
add_assoc_long(&fpm_proc_stat, "pid", proc_p->pid);
|
||||
@@ -573,11 +577,15 @@
|
||||
}
|
||||
|
||||
/* prevent NaN */
|
||||
|
||||
@ -18,6 +18,7 @@ COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--disable-strip
|
||||
--sysconfdir=/etc/ssh
|
||||
)
|
||||
export CFLAGS+=" -DSYSTEMD_NOTIFY=1"
|
||||
cookbook_configure
|
||||
mv "${COOKBOOK_STAGE}"/usr/sbin/sshd "${COOKBOOK_STAGE}"/usr/bin/sshd
|
||||
rmdir "${COOKBOOK_STAGE}"/usr/sbin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user