Files
shop-platform/docker/php/entrypoint.sh

19 lines
533 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 确保目录所有者为www-data, 组为www-data, 权限为755
# 这是因为 PHP 进程实际运行时使用的是 Web 服务器用户(如 www-data而不是 root 用户
chown -R www-data:www-data /var/www/html
# 检查并创建必要的目录
for dir in "/var/www/html/runtime" "/var/www/html/upload"; do
if [ ! -d "$dir" ]; then
mkdir -p "$dir"
echo "创建目录: $dir"
fi
# 设置权限
chmod -R 755 "$dir"
echo "设置权限: $dir -> 755"
done
# 执行原有的启动命令
exec "$@"