[GH-ISSUE #1436] 500 Internal Server Error on koel_ip:port/api/me #821

Closed
opened 2026-02-26 02:34:21 +03:00 by kerem · 6 comments
Owner

Originally created by @vvzvlad on GitHub (Mar 27, 2022).
Original GitHub issue: https://github.com/koel/koel/issues/1436

I installed koel, set up a connection to the database and scanned the songs. Everything is ok. But I can't get into the control panel, a red frame appears around the login form when I enter my username and password (by the way, don't you think the "invalid credentials" indication when you get error 500 is misleading to the user?) After making sure that the password is correct, I went into the browser console and saw that the request to the api ends with an error 500. How do I solve this problem?
image

Originally created by @vvzvlad on GitHub (Mar 27, 2022). Original GitHub issue: https://github.com/koel/koel/issues/1436 I installed koel, set up a connection to the database and scanned the songs. Everything is ok. But I can't get into the control panel, a red frame appears around the login form when I enter my username and password (by the way, don't you think the "invalid credentials" indication when you get error 500 is misleading to the user?) After making sure that the password is correct, I went into the browser console and saw that the request to the api ends with an error 500. How do I solve this problem? <img width="721" alt="image" src="https://user-images.githubusercontent.com/3315944/160280417-4d19536c-6989-4a0a-8062-fb4a9a909f11.png">
kerem closed this issue 2026-02-26 02:34:21 +03:00
Author
Owner

@andrewwippler commented on GitHub (Apr 1, 2022):

You are running apache2 and will need to sudo a2enmod rewrite && sudo systemctl restart apache2.

<!-- gh-comment-id:1086257285 --> @andrewwippler commented on GitHub (Apr 1, 2022): You are running apache2 and will need to `sudo a2enmod rewrite && sudo systemctl restart apache2`.
Author
Owner

@alexeydk78 commented on GitHub (Apr 8, 2022):

If I need a rewrite module, then I need some directives in server config, right?

<!-- gh-comment-id:1092479395 --> @alexeydk78 commented on GitHub (Apr 8, 2022): If I need a rewrite module, then I need some directives in server config, right?
Author
Owner

@andrewwippler commented on GitHub (Apr 8, 2022):

That's right. Here is an example:

DocumentRoot /var/www/html/koel/public
<Directory /var/www/html/koel>
       AllowOverride All
</Directory>
<!-- gh-comment-id:1092650954 --> @andrewwippler commented on GitHub (Apr 8, 2022): That's right. Here is an example: ``` DocumentRoot /var/www/html/koel/public <Directory /var/www/html/koel> AllowOverride All </Directory> ```
Author
Owner

@alexeydk78 commented on GitHub (Apr 9, 2022):

Ok. This is my virtualhost definition:

<VirtualHost *:81>
        ServerName my.radio

        CustomLog /var/log/apache2/my.radio-access.log combined
        ErrorLog /var/log/apache2/my.radio-error.log

        DocumentRoot /var/www/radio/public

        <Directory /var/www/radio>
                Options Indexes FollowSymlinks
                AllowOverride All
                Require all granted
        </Directory>

        <IfModule mod_xsendfile.c>
                XSendFile on
                XSendFilePath /mnt/nfs/radio
        </IfModule>
</VirtualHost>

Still getting 500 error. Is there any log where I can find source of the error? There is nothing in apache's error log.

<!-- gh-comment-id:1093829492 --> @alexeydk78 commented on GitHub (Apr 9, 2022): Ok. This is my virtualhost definition: ``` <VirtualHost *:81> ServerName my.radio CustomLog /var/log/apache2/my.radio-access.log combined ErrorLog /var/log/apache2/my.radio-error.log DocumentRoot /var/www/radio/public <Directory /var/www/radio> Options Indexes FollowSymlinks AllowOverride All Require all granted </Directory> <IfModule mod_xsendfile.c> XSendFile on XSendFilePath /mnt/nfs/radio </IfModule> </VirtualHost> ``` Still getting 500 error. Is there any log where I can find source of the error? There is nothing in apache's error log.
Author
Owner

@andrewwippler commented on GitHub (Apr 25, 2022):

The web appliclation is the source of the 500 error. Generally, you would look at the application's logs for those error messages. Since koel is a PHP application, you will find the error messages in PHP's error log.

A quick glance at your config shows that you are defining Options and AllowOverride. You should only define one or the other. AllowOverride gives the web application control to define its needs whereas the Options is the server administrator forcing the use of these options only.

Apache configuration files work in ACL fashion. What is listed first has priority over the remaining entries. Your config is basically saying, the web application can only index and follow symlinks, but koel needs more permissions from the webserver. The AllowOverride All line is never considered by apache since the Options is listed first.

I have already written too much concerning a simple fix (remove the options line), but I hope with this extra knowledge you can look at PHP's error logs and tweak Options to grant only the necessary permissions koel needs. This is the best security practice over what I previously suggested - granting full access: AllowOverride All.

<!-- gh-comment-id:1108342558 --> @andrewwippler commented on GitHub (Apr 25, 2022): The web appliclation is the source of the 500 error. Generally, you would look at the application's logs for those error messages. Since koel is a PHP application, you will find the error messages in PHP's error log. A quick glance at your config shows that you are defining `Options` and `AllowOverride`. You should only define one or the other. `AllowOverride` gives the web application control to define its needs whereas the `Options` is the server administrator forcing the use of these options only. Apache configuration files work in ACL fashion. What is listed first has priority over the remaining entries. Your config is basically saying, the web application can only index and follow symlinks, but koel needs more permissions from the webserver. The `AllowOverride All` line is never considered by apache since the `Options` is listed first. I have already written too much concerning a simple fix (`remove the options line`), but I hope with this extra knowledge you can look at PHP's error logs and tweak `Options` to grant only the necessary permissions koel needs. This is the best security practice over what I previously suggested - granting full access: `AllowOverride All`.
Author
Owner

@phanan commented on GitHub (May 16, 2022):

I'll go ahead and close the issue, as it has nothing to do with Koel, and I can't provide server-setup support.

<!-- gh-comment-id:1127917324 --> @phanan commented on GitHub (May 16, 2022): I'll go ahead and close the issue, as it has nothing to do with Koel, and I can't provide server-setup support.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#821
No description provided.