Skip to content

Commit e6d6e23

Browse files
MingcongBaixtexx
authored andcommitted
fix(fpm): define perferences for AOSC OS
- Use syslog (-> journald) infrastructure to output server logs. - Listen /run/php-fpm/php-fpm.sock to integrate with systemd. - Set default server root at /srv/http, consistent with httpd. - Enable non-root daemon owners users and groups. - Set php-fpm PID file path to /run/php-fpm/php-fpm.pid (instead of ./run/php-fpm.pid). - Install configurations at /etc/php-fpm.conf and /etc/php-fpm.d/www.conf.
1 parent 9327bec commit e6d6e23

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

sapi/fpm/Makefile.frag

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ install-fpm: $(SAPI_FPM_PATH)
1515
else \
1616
echo "Installing PHP FPM defconfig: $(INSTALL_ROOT)$(sysconfdir)/" && \
1717
$(mkinstalldirs) $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d; \
18-
$(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf.default; \
19-
$(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf.default; \
18+
$(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf; \
19+
$(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf; \
2020
fi
2121

2222
@echo "Installing PHP FPM man page: $(INSTALL_ROOT)$(mandir)/man8/"

sapi/fpm/php-fpm.conf.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
; Pid file
1515
; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
1616
; Default Value: none
17-
;pid = run/php-fpm.pid
17+
;pid = /run/php-fpm/php-fpm.pid
1818

1919
; Error log file
2020
; If it's set to "syslog", log is sent to syslogd instead of being written
2121
; into a local file.
2222
; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
2323
; Default Value: log/php-fpm.log
24-
;error_log = log/php-fpm.log
24+
error_log = syslog
2525

2626
; syslog_facility is used to specify what type of program is logging the
2727
; message. This lets syslogd specify that messages from different facilities

sapi/fpm/php-fpm.service.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ After=network.target
88

99
[Service]
1010
Type=@php_fpm_systemd@
11-
PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
11+
PIDFile=/run/php-fpm/php-fpm.pid
1212
ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
1313
ExecReload=/bin/kill -USR2 $MAINPID
1414

sapi/fpm/www.conf.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ group = @php_fpm_group@
3838
; (IPv6 and IPv4-mapped) on a specific port;
3939
; '/path/to/unix/socket' - to listen on a unix socket.
4040
; Note: This value is mandatory.
41-
listen = 127.0.0.1:9000
41+
listen = /run/php-fpm/php-fpm.sock
4242

4343
; Set listen(2) backlog.
4444
; Default Value: 511 (-1 on Linux, FreeBSD and OpenBSD)
@@ -50,8 +50,8 @@ listen = 127.0.0.1:9000
5050
; and group can be specified either by name or by their numeric IDs.
5151
; Default Values: Owner is set to the master process running user. If the group
5252
; is not set, the owner's group is used. Mode is set to 0660.
53-
;listen.owner = @php_fpm_user@
54-
;listen.group = @php_fpm_group@
53+
listen.owner = @php_fpm_user@
54+
listen.group = @php_fpm_group@
5555
;listen.mode = 0660
5656

5757
; When POSIX Access Control Lists are supported you can set them using
@@ -422,7 +422,7 @@ pm.max_spare_servers = 3
422422
; Chdir to this directory at the start.
423423
; Note: relative path can be used.
424424
; Default Value: current directory or / when chroot
425-
;chdir = /var/www
425+
;chdir = /srv/http
426426

427427
; Redirect worker stdout and stderr into main error log. If not set, stdout and
428428
; stderr will be redirected to /dev/null according to FastCGI specs.

0 commit comments

Comments
 (0)