Skip to content

Commit

Permalink
Add NGINX Build and flexible configuration for fast cgi
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed May 24, 2024
1 parent 0cc216d commit 8bfc3e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/script/start-fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ FPMWWW="/etc/$PHP_VARIANT/php-fpm.d/www.conf"
FPMENV="/etc/$PHP_VARIANT/php-fpm.d/env.conf"
FPMMAIN="/etc/$PHP_VARIANT/php-fpm.conf"

VERBOSE_MODE=false
if [ "$VERBOSE" == "true" ]
then
VERBOSE_MODE=true
fi

${VERBOSE_MODE} && echo "=== PHP-FPM ==========================================================="

if [ -z "$PHP_FPM_SERVER" ]
then
PHP_FPM_SERVER=0.0.0.0:9000
Expand Down Expand Up @@ -40,8 +43,9 @@ function setEnvironmentVariable() {
# Grep for variables that look like docker set them (_PORT_)
if [ -z "$PHP_FPM_IGNORE_ENV"]
then
${VERBOSE_MODE} && echo "Environment Variables: "
echo "clear_env = no" > $FPMENV
for _curVar in `env | awk -F = '{print $1}'`;do
for _curVar in `env | sort | awk -F = '{print $1}'`;do
# awk has split them by the equals sign
# Pass the name and value to our function
setEnvironmentVariable ${_curVar} ${!_curVar}
Expand Down
7 changes: 7 additions & 0 deletions assets/script/start-nginx.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/usr/bin/env bash

VERBOSE_MODE=false
if [ "$VERBOSE" == "true" ]
then
VERBOSE_MODE=true
fi

${VERBOSE_MODE} && echo "=== NGINX ==========================================================="

if [ -z "$NGINX_ROOT" ]
then
NGINX_ROOT=/var/www/html
fi
if [ -z "$PHP_FPM_SERVER" ]
then
PHP_FPM_SERVER=127.0.0.1:9000
fi

${VERBOSE_MODE} && echo "Setting root to '$NGINX_ROOT'"
sed -i "s|^\(\s*root\s*\)@root@;$|\1$NGINX_ROOT;|g" /etc/nginx/http.d/default.conf
Expand Down

0 comments on commit 8bfc3e8

Please sign in to comment.