Getting a 500 Internal Server Error when trying to run my CodeIgniter 4 PHP app

I changed “public_html” to “public_html/public” in ‘Website documents sub-directory’ within the “Website Options” page in Virtualmin (because CodeIgniter 4’s public directory is in ‘public’ where the index.php file lives). And I’m getting a 500 Internal Server Error. I made sure it wasn’t the actual CodeIgniter 4 installation itself and narrowed it down to the Virtualmin server.

The server works just fine if I have a normal index.html file inside, but for some reason won’t work when a Codeigniter 4 app is installed.

Any thoughts? Thanks in advance~

SYSTEM INFORMATION
OS type and version Ubuntu Linux 24.04.1
Virtualmin version 7.30.3

was getting the ~/public_html/public/.htaccess: Option FollowSymlinks not allowed here error in the apache logs.

So I sudo nano /etc/apache2/sites-available/website.mydomain.com.conf

and changed

<Directory /home/<username>/public_html/public>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch 
    Require all granted
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>

to

<Directory /home/<username>/public_html/public>
    Options +FollowSymlinks +IncludesNOEXEC -Indexes
    Require all granted
    AllowOverride All
</Directory>

restarted Apache

And now my app works fine now. I wonder if there was a way to do this from within Virtualmin…

Virtualmin > Web Configuration > Website Options > Website documents sub-directory

Goto my page

https://quantumwarp.com/kb/articles/34-web-server/1016-my-virtualmin-notes

and search for Options +FollowSymlinks’ causes 500 error as it explains this error and why SymLinksIfOwnerMatch is more secure and should be left on.

1 Like

The right solution is not that.

You need to fix ownership of those files, or figure out what it’s doing with files outside of the user home and fix that.

What is wrong with the solution that I posted?

FollowSymLinks has security implications, and there’s no reason to use it. You can just fix file ownership.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.