diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 65383ff5e..9e9c624ec 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,9 @@
-
+
+
+
diff --git a/cyberpanel.sh b/cyberpanel.sh
index e38f7c48f..a7b4e5ad7 100644
--- a/cyberpanel.sh
+++ b/cyberpanel.sh
@@ -140,6 +140,42 @@ detect_os() {
return 0
}
+# Function to fix static file permissions (critical for LiteSpeed)
+fix_static_file_permissions() {
+ echo " 🔧 Fixing static file permissions for web server access..."
+
+ # CRITICAL: Fix ownership and permissions for all public files
+ # LiteSpeed requires files to be owned by lscpd and NOT have execute permissions
+
+ # Check if the public directory exists
+ if [ -d "/usr/local/CyberCP/public/" ]; then
+ echo " • Setting ownership to lscpd:lscpd for public directory..."
+ chown -R lscpd:lscpd /usr/local/CyberCP/public/ 2>/dev/null || true
+
+ echo " • Setting directory permissions to 755..."
+ find /usr/local/CyberCP/public/ -type d -exec chmod 755 {} \; 2>/dev/null || true
+
+ echo " • Setting file permissions to 644 (removing execute bit)..."
+ find /usr/local/CyberCP/public/ -type f -exec chmod 644 {} \; 2>/dev/null || true
+
+ # Ensure parent directories have correct permissions
+ chmod 755 /usr/local/CyberCP/public/ 2>/dev/null || true
+ chmod 755 /usr/local/CyberCP/public/static/ 2>/dev/null || true
+
+ echo " ✅ Static file permissions fixed successfully"
+ else
+ echo " ⚠️ Warning: /usr/local/CyberCP/public/ directory not found"
+ fi
+
+ # Also check the alternative path
+ if [ -d "/usr/local/CyberPanel/public/" ]; then
+ echo " • Fixing permissions for /usr/local/CyberPanel/public/..."
+ chown -R lscpd:lscpd /usr/local/CyberPanel/public/ 2>/dev/null || true
+ find /usr/local/CyberPanel/public/ -type d -exec chmod 755 {} \; 2>/dev/null || true
+ find /usr/local/CyberPanel/public/ -type f -exec chmod 644 {} \; 2>/dev/null || true
+ fi
+}
+
# Function to fix post-installation issues
fix_post_install_issues() {
echo " 🔧 Fixing database connection issues..."
@@ -683,12 +719,11 @@ install_cyberpanel_direct() {
# Check if installation was successful
if [ $install_exit_code -eq 0 ]; then
print_status "SUCCESS: CyberPanel installed successfully"
-
- # Run post-installation fixes
- # echo ""
- # echo " 🔧 Running post-installation fixes..."
- # fix_post_install_issues
-
+
+ # Run static file permission fixes (critical for LiteSpeed)
+ echo ""
+ fix_static_file_permissions
+
return 0
else
print_status "ERROR: CyberPanel installation failed (exit code: $install_exit_code)"
diff --git a/install/install.py b/install/install.py
index 9b8f5fca6..f3e44d46a 100644
--- a/install/install.py
+++ b/install/install.py
@@ -2229,16 +2229,6 @@ password="%s"
command = 'mv static /usr/local/CyberCP/public/'
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
- ## Set proper permissions for static files
- command = 'chown -R lscpd:lscpd /usr/local/CyberCP/public/static'
- preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
-
- command = r'find /usr/local/CyberCP/public/static -type d -exec chmod 755 {} \;'
- preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
-
- command = r'find /usr/local/CyberCP/public/static -type f -exec chmod 644 {} \;'
- preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
-
try:
path = "/usr/local/CyberCP/version.txt"
writeToFile = open(path, 'w')
@@ -2400,12 +2390,12 @@ class Migration(migrations.Migration):
command = "chown -R lscpd:lscpd /usr/local/CyberCP/public/phpmyadmin/tmp"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
- ## Fix ownership and permissions for all public files (must be owned by lscpd for web server access)
- ## Static files (CSS, JS, images) must NOT have execute permissions - LiteSpeed blocks files with unnecessary execute bits
+ ## CRITICAL FIX: Restore public directory ownership after root:root override
+ ## The public directory MUST be owned by lscpd for web server to serve files
command = "chown -R lscpd:lscpd /usr/local/CyberCP/public/"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
- ## Set proper permissions: directories get 755, files get 644 (no execute bit for static files!)
+ ## Ensure correct permissions: directories 755, files 644 (NO execute bit on static files!)
command = r'find /usr/local/CyberCP/public/ -type d -exec chmod 755 {} \;'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
diff --git a/plogical/upgrade.py b/plogical/upgrade.py
index ec8f2deef..7bdf0bded 100644
--- a/plogical/upgrade.py
+++ b/plogical/upgrade.py
@@ -3343,18 +3343,6 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = "chown -R lscpd:lscpd /usr/local/CyberCP/public/phpmyadmin/tmp"
Upgrade.executioner(command, 'chown core code', 0)
- ## Fix ownership and permissions for all public files (must be owned by lscpd for web server access)
- ## Static files (CSS, JS, images) must NOT have execute permissions - LiteSpeed blocks files with unnecessary execute bits
- command = "chown -R lscpd:lscpd /usr/local/CyberCP/public/"
- Upgrade.executioner(command, 'Fix public directory ownership', 0)
-
- ## Set proper permissions: directories get 755, files get 644 (no execute bit for static files!)
- command = "find /usr/local/CyberCP/public/ -type d -exec chmod 755 {} \;"
- Upgrade.executioner(command, 'Fix public directory permissions', 0)
-
- command = "find /usr/local/CyberCP/public/ -type f -exec chmod 644 {} \;"
- Upgrade.executioner(command, 'Fix public file permissions', 0)
-
## change owner
command = "chown -R root:root /usr/local/lscp"