Skip to content

Commit 3ead8cd

Browse files
authored
[pkgcfg] Ensure php-fpm works out of the box (#334)
## Summary This makes php-fpm work pretty much out of the box. It creates an php-fpm config (deamonized). Adds default ports and always includes `ProxyPassMatch` in the apache config (because it should not break anything if even if not used) ## How was it tested? ``` devbox add php apacheHttpd devbox shell php-from apachectl start -f $HTTPD_CONFDIR/httpd.conf ```
1 parent 3b6960a commit 3ead8cd

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

pkgcfg/package-configuration/apache/httpd.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ErrorLog "${HTTPD_CONFDIR}/error.log"
5757
</Directory>
5858

5959
## Added for php-fpm
60-
# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://{LOCALHOST}:{PHPFPM_PORT}/<?php echo $root ?>/$1
60+
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:8082/${PWD}/web/$1
6161
DirectoryIndex index.html
6262

6363
</VirtualHost>

pkgcfg/package-configuration/apacheHttpd.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "apache",
33
"version": "0.0.1",
4-
"readme": "To start use \"apachectl start -f $HTTPD_CONFDIR/httpd.conf\".",
4+
"readme": "To start use \"apachectl start -f $HTTPD_CONFDIR/httpd.conf\".\n\nIf you with to edit the config file, please copy it out of the .devbox directory.",
55
"env": {
6-
"HTTPD_CONFDIR": "{{ .DevboxRoot }}/conf/apache"
6+
"HTTPD_CONFDIR": "{{ .DevboxRoot }}/conf/apache",
7+
"HTTPD_PORT": "8080"
78
},
89
"create_files": {
910
".devbox/conf/apache/httpd.conf": "apache/httpd.conf"

pkgcfg/package-configuration/php.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22
"name": "php",
33
"version": "0.0.1",
44
"match": "^php[0-9]*$",
5-
"readme": "PHP is compiled with default extensions. If you would like to use non-default extensions you can add them with devbox add php81Extensions.{extension} . For example, for the memcache extension you can do `devbox add php81Extensions.memcached`"
5+
"readme": "PHP is compiled with default extensions. If you would like to use non-default extensions you can add them with devbox add php81Extensions.{extension} . For example, for the memcache extension you can do `devbox add php81Extensions.memcached`.\n\nTo run with apache/nginx you may want to use the php-fpm shim.",
6+
"env": {
7+
"PHPFPM_PORT": "8082"
8+
},
9+
"create_files": {
10+
".devbox/conf/php/php-fpm": "php/php-fpm",
11+
".devbox/conf/php/php-fpm.conf": "php/php-fpm.conf"
12+
}
613
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ .DevboxProfileDefault }}/bin/php-fpm -y {{ .DevboxRoot }}/conf/php/php-fpm.conf -p $PWD
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[global]
2+
pid = .devbox/conf/php/php-fpm.pid
3+
error_log = .devbox/conf/php/php-fpm.log
4+
daemonize = yes
5+
6+
[www]
7+
; user = www-data
8+
; group = www-data
9+
listen = 127.0.0.1:${PHPFPM_PORT}
10+
; listen.owner = www-data
11+
; listen.group = www-data
12+
pm = dynamic
13+
pm.max_children = 5
14+
pm.start_servers = 2
15+
pm.min_spare_servers = 1
16+
pm.max_spare_servers = 3
17+
chdir = /

0 commit comments

Comments
 (0)