This commit is contained in:
2025-08-11 01:30:33 +03:00
parent f0f9716eb0
commit 4559aefe5a

View File

@@ -494,10 +494,6 @@ cat > "$APACHE_CONF" <<EOF
<Files "*.conf">
Require all denied
</Files>
<Files "db_config.php">
Require all denied
</Files>
<Files ".htaccess">
Require all denied
@@ -575,8 +571,23 @@ define('DB_CHARSET', 'utf8mb4');
define('OFFICE', '/usr/bin/libreoffice');
?>
EOF
chown $WEBSERVER_USER:$WEBSERVER_USER "$WEBROOT/db_config.php"
chmod 644 "$WEBROOT/db_config.php"
log_success "Конфигурация БД создана"
if [ ! -f "$WEBROOT/db_config.php" ]; then
log_error "Не удалось создать файл db_config.php"
exit 1
fi
if ! sudo -u $WEBSERVER_USER test -r "$WEBROOT/db_config.php"; then
log_warning "Веб-сервер не может прочитать db_config.php, исправляем права..."
chown $WEBSERVER_USER:$WEBSERVER_USER "$WEBROOT/db_config.php"
chmod 644 "$WEBROOT/db_config.php"
fi
DOWNLOAD_URL="https://cloud.altcor.ru/setup/download.php"
TEMP_DOWNLOAD="/tmp/web_files_$(date +%s)"
@@ -654,12 +665,10 @@ fi
log_step "Настройка прав доступа к файлам..."
chown $WEBSERVER_USER:$WEBSERVER_USER "$WEBROOT/index.php"
chmod 644 "$WEBROOT/index.php"
chmod 644 "$WEBROOT/db_config.php"
chown $WEBSERVER_USER:$WEBSERVER_USER "$WEBROOT/db_config.php"
cat > "$WEBROOT/.htaccess" << 'EOF'
<Files "db_config.php">
Require all denied
</Files>
<Files "*.conf">
Require all denied