Fix: Apache Fails to Start with "mod_lua.so" Error in aaPanel
Error Description
When starting or restarting Apache in aaPanel, users may encounter the following error:
Copy
httpd: Syntax error on line 502 of /www/server/apache/conf/httpd.conf:
Syntax error on line 1 of /www/server/panel/vhost/apache/btwaf.conf:
Cannot load modules/mod_lua.so into server: liblua5.3.so.0: cannot open shared object file: No such file or directory
This happens because Apache’s WAF (mod_lua) requires liblua5.3, but it’s missing on the system.
Solution (Verified Working)
- Install liblua5.3 (Required Dependency)
Run the appropriate command for your OS:
For Debian/Ubuntu:
bash
Copy
sudo apt-get update && sudo apt-get install liblua5.3-0 -y
For CentOS/RockyLinux/AlmaLinux:
bash
Copy
sudo yum install lua5.3 -y
For Arch Linux (if applicable):
bash
Copy
sudo pacman -S lua53
- Restart Apache
After installing liblua5.3, restart Apache:
bash
Copy
systemctl restart httpd # For Apache
✅ Apache should now start without errors.
Alternative Fixes (If the Problem Persists)
A. Reinstall Apache with Lua Support
If the error remains, reinstall Apache via aaPanel:
bash
Copy
cd /www/server/panel/install
./install_soft.sh 0 apache 2.4
B. Disable mod_lua (Temporary Fix)
If you don’t need Lua support (e.g., not using WAF), disable it:
Edit the WAF config:
bash
Copy
nano /www/server/panel/vhost/apache/btwaf.conf
Comment out this line:
apache
Copy
LoadModule lua_module modules/mod_lua.so
Restart Apache:
bash
Copy
systemctl restart httpd
C. Reinstall aaPanel’s WAF Module
If the issue is still unresolved, reinstall the WAF:
bash
Copy
sh /www/server/panel/install/install_soft.sh 0 waf
Preventive Measures
Keep aaPanel Updated
bash
Copy
bt update
Check Dependencies Before Installing Apache/Nginx
Ensure liblua5.3 is installed before enabling WAF.
Final Notes
This issue is common after fresh aaPanel installations or Apache updates.
If you still face problems, check logs:
bash
Copy
tail -n 50 /www/server/apache/logs/error_log
💡 Did this solve your issue? Let others know in the replies! If you have a different solution, share it below.
Credits
Reported by: Kostas
Tested on: [Your OS, e.g., Ubuntu 22.04 / CentOS 7]
aaPanel Version: [Your aaPanel version, 2.5.0