diff --git a/install.sh b/install.sh index f6c2941..13d3055 100644 --- a/install.sh +++ b/install.sh @@ -494,10 +494,6 @@ cat > "$APACHE_CONF" < Require all denied - - - Require all denied - 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' - - Require all denied - Require all denied