Fix PHP-FPM compatibility and add server diagnostics

Changes to .htaccess:
- Removed php_flag and php_value directives (don't work with php-fpm)
- Simplified DirectoryMatch to FilesMatch for .json files
- Added note about configuring PHP settings in php.ini/pool config
- More compatible with user directories

Added diagnostic.php:
- Tests PHP version, extensions, and configuration
- Checks storage directory permissions
- Tests Server-Sent Events (SSE) connection
- Shows server API type (php-fpm vs mod_php)
- Provides troubleshooting hints for common issues
- Live SSE connection test with detailed logging

Added data/index.php:
- Blocks direct access to data directory
- Returns 403 Forbidden

Fixes:
- php-fpm environments not respecting .htaccess PHP settings
- DirectoryMatch issues in user directories
- Hard to diagnose connection problems

Usage: Navigate to diagnostic.php to troubleshoot server issues
This commit is contained in:
2025-12-26 12:45:23 -08:00
parent 1acdb065c5
commit af1c1231b6
3 changed files with 219 additions and 12 deletions

View File

@@ -1,22 +1,15 @@
# Security settings for Multi-User Transcription Server
# Deny access to data directory
<DirectoryMatch "^.*/data/.*$">
Require all denied
</DirectoryMatch>
# Compatible with both mod_php and php-fpm
# Deny access to config file directly (if accessed via URL)
<Files "config.php">
Require all denied
</Files>
# Enable PHP error logging (disable display for production)
php_flag display_errors Off
php_flag log_errors On
# Set upload limits
php_value upload_max_filesize 1M
php_value post_max_size 1M
# Deny access to .json data files
<FilesMatch "\.json$">
Require all denied
</FilesMatch>
# Disable directory listing
Options -Indexes
@@ -29,3 +22,7 @@ Options -Indexes
# Set MIME types
AddType application/json .json
AddType text/event-stream .php
# NOTE: PHP settings (display_errors, upload limits) must be configured in:
# - For php-fpm: /etc/php/X.X/fpm/pool.d/www.conf or php.ini
# - For mod_php: Can use php_flag/php_value directives here