代码拉取完成,页面将自动刷新
#!/usr/bin/env bash
set -x
OS=$(uname -s)
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
cd ${__DIR__}
mkdir -p ${__DIR__}/bin/runtime/var/log/
mkdir -p ${__DIR__}/bin/runtime/var/run/
test -f ${__DIR__}/bin/runtime/nginx/sbin/nginx || bash setup-nginx-runtime.sh
# test -f ${__DIR__}/runtime/swoole-cli || bash setup-swoole-cli-runtime.sh
test -f ${__DIR__}/bin/runtime/php-fpm || bash setup-php-fpm-runtime.sh
# 启用 php-fpm
# 更多配置参考: https://segmentfault.com/a/1190000042773837
# swoole-cli -P --fpm-config /opt/php-8.1/etc/php-fpm.conf -p /opt/php-8.1/var
test -f php-fpm.conf || cp -f php-fpm.example.conf php-fpm.conf
if [ "$OS" = 'Darwin' ]; then
# 非 root 设置此项无效
USER=$(whoami)
GROUP=$(groups $(whoami) | cut -d' ' -f1)
# chown -R $(whoami):staff
sed -i.bak "s/user = nobody/user = ${USER}/" php-fpm.conf
sed -i.bak "s/group = nogroup/group = ${GROUP}/" php-fpm.conf
test -f php-fpm.conf.bak && rm -f php-fpm.conf.bak
fi
if [ ! -f php.ini ]; then
echo "curl.cainfo=\"${__DIR__}/bin/runtime/cacert.pem\"" >php.ini
echo "openssl.cafile=\"${__DIR__}/bin/runtime/cacert.pem\"" >>php.ini
cat php.example.ini >>php.ini
fi
cp -f php-fpm.conf ${__DIR__}/bin/runtime/php-fpm.conf
cp -f php.ini ${__DIR__}/bin/runtime/php.ini
# swoole-cli 提供 php-fpm
#${__DIR__}/bin/runtime/swoole-cli -c ${__DIR__}/bin/runtime/php.ini -P --fpm-config ${__DIR__}/bin/runtime/php-fpm.conf -p ${__DIR__}/runtime/var
# 原生 php-fpm
${__DIR__}/bin/runtime/php-fpm -c ${__DIR__}/bin/runtime/php.ini --fpm-config ${__DIR__}/bin/runtime/php-fpm.conf -p ${__DIR__}/bin/runtime/var
# 查看 nginx help
# ${__DIR__}/bin/runtime/nginx/sbin/nginx -h
test -f nginx.conf || cp -f nginx.example.conf nginx.conf
cp -f ${__DIR__}/nginx.conf ${__DIR__}/bin/runtime/nginx/conf/nginx.conf
# 启动 nginx
${__DIR__}/bin/runtime/nginx/sbin/nginx -p ${__DIR__}/bin/runtime/nginx/
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。