[GH-ISSUE #620] Error 500 upon login (ie. unable to login) #444

Closed
opened 2026-02-26 02:33:14 +03:00 by kerem · 1 comment
Owner

Originally created by @zhiayang on GitHub (Jul 9, 2017).
Original GitHub issue: https://github.com/koel/koel/issues/620

Hello

So, I'm basically looking at the koel login screen; pressing "login" gives me an error 500 on /api/me. I'm using v3.4.2 on arch, and running via php artisan serve --host=0.0.0.0, plus an nginx reverse proxy as such:

server {
	listen 443 ssl http2;

	root /home/zhiayang/server/koel;

	location / {
		proxy_pass				http://127.0.0.1:8000;
		proxy_set_header		X-Real-IP $remote_addr;
		proxy_set_header		Host $host;
		proxy_set_header		X-Forwarded-for $proxy_add_x_forwarded_for;
		proxy_redirect			off;
		try_files				$uri $uri/ /index.php?$args;
	}

	location /media/ {
		internal;

		# A 'X-Media-Root' should be set to media_path settings from upstream
		alias					$upstream_http_x_media_root;
	}

	# location of php-fpm socket
	location ~ \.php$ {
		try_files					$uri $uri/ /index.php?$args;
		fastcgi_param				PATH_INFO $fastcgi_path_info;
		fastcgi_param				PATH_TRANSLATED $document_root$fastcgi_path_info;
		fastcgi_param				SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param				MOD_X_ACCEL_REDIRECT_ENABLED on;
		fastcgi_read_timeout		6000s;
		fastcgi_pass				127.0.0.1:9000;
		fastcgi_index				index.php;
		fastcgi_buffer_size			128k;
		fastcgi_buffers				256 16k;
		fastcgi_busy_buffers_size	256k;
		include						fastcgi.conf;
		fastcgi_temp_file_write_size 256k;
	}
}

I'd like to give more information, but I'm really not sure where to get the necessary logs. I don't have any /var/log/nginx/error.log, and koel itself isn't showing any error messages that I know of.

Thanks

EDIT:
So, after digging around (and setting error_log in my nginx config, no idea why it isn't on by default) I've gone and disabled fix_pathinfo in my php config, and now I'm getting to a 403 error with this:

FastCGI sent in stderr: "Access to the script '/home/zhiayang/server/koel' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 192.168.1.1, server: sounds.zhiayang.com, request: "POST /api/me HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "<redacted>", referrer: "https://<redacted>/"

And so following the trail I disabled security.limit_extensions (by setting it empty)... now I'm at a 404 error, with this:

*1 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: failed to open stream: Success in Unknown on line 0
Unable to open primary script: /home/zhiayang/server/koel (Success)" while reading response header from upstream, client: 192.168.1.1, server: <redacted>, request: "POST /api/me HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "<redacted>", referrer: "https://<redacted>/"

It actually looks like it's trying to access the server/koel directory as a file or something? I'm still getting the 404 on /api/me, however.

EDIT 2: guess not, access log tells me this:

192.168.1.1 - - [09/Jul/2017:15:36:34 +0800] "POST /api/me HTTP/2.0" 404 45 "https://<redacted>/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"

  • You have read and followed closely the Wiki, Upgrade Guide, as well as Troubleshooting
  • The issue has not been reported before
  • This is not a "how to install on Windows" or "why is my npm messed up" question
  • You're a cool person

All checked? Now also make sure your issue

  • Is associated with a version. Or better yet, a commit.
  • Is as detailed as possible (ahem... OS, browser, steps to reproduce, maybe?)
  • Includes the error output if it's a bug/error report ("Whoops!" is not very helpful, you know)
  • Is in English, 因为我不说中文。
Originally created by @zhiayang on GitHub (Jul 9, 2017). Original GitHub issue: https://github.com/koel/koel/issues/620 Hello So, I'm basically looking at the koel login screen; pressing "login" gives me an error 500 on `/api/me`. I'm using v3.4.2 on arch, and running via `php artisan serve --host=0.0.0.0`, plus an nginx reverse proxy as such: ``` server { listen 443 ssl http2; root /home/zhiayang/server/koel; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; proxy_redirect off; try_files $uri $uri/ /index.php?$args; } location /media/ { internal; # A 'X-Media-Root' should be set to media_path settings from upstream alias $upstream_http_x_media_root; } # location of php-fpm socket location ~ \.php$ { try_files $uri $uri/ /index.php?$args; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on; fastcgi_read_timeout 6000s; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_buffer_size 128k; fastcgi_buffers 256 16k; fastcgi_busy_buffers_size 256k; include fastcgi.conf; fastcgi_temp_file_write_size 256k; } } ``` I'd like to give more information, but I'm really not sure where to get the necessary logs. I don't have any `/var/log/nginx/error.log`, and `koel` itself isn't showing any error messages that I know of. Thanks EDIT: So, after digging around (and setting `error_log` in my nginx config, no idea why it isn't on by default) I've gone and disabled `fix_pathinfo` in my `php` config, and now I'm getting to a `403` error with this: ``` FastCGI sent in stderr: "Access to the script '/home/zhiayang/server/koel' has been denied (see security.limit_extensions)" while reading response header from upstream, client: 192.168.1.1, server: sounds.zhiayang.com, request: "POST /api/me HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "<redacted>", referrer: "https://<redacted>/" ``` And so following the trail I disabled `security.limit_extensions` (by setting it empty)... now I'm at a `404` error, with this: ``` *1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: failed to open stream: Success in Unknown on line 0 Unable to open primary script: /home/zhiayang/server/koel (Success)" while reading response header from upstream, client: 192.168.1.1, server: <redacted>, request: "POST /api/me HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "<redacted>", referrer: "https://<redacted>/" ``` It actually looks like it's trying to access the `server/koel` directory as a file or something? I'm still getting the `404` on `/api/me`, however. EDIT 2: guess not, access log tells me this: ``` 192.168.1.1 - - [09/Jul/2017:15:36:34 +0800] "POST /api/me HTTP/2.0" 404 45 "https://<redacted>/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36" ``` --------- - [x] You have read and followed closely the [Wiki](https://koel.phanan.net/docs), [Upgrade Guide](https://github.com/phanan/koel/releases), as well as [Troubleshooting](https://koel.phanan.net/docs/#/troubleshooting) - [x] The issue has not been reported before - [x] This is not a "how to install on Windows" or "why is my npm messed up" question - [x] You're a cool person All checked? Now also make sure your issue - [x] Is associated with a version. Or better yet, a commit. - [x] Is as detailed as possible (ahem... OS, browser, steps to reproduce, maybe?) - [x] Includes the error output if it's a bug/error report ("Whoops!" is not very helpful, you know) - [x] Is in English, 因为我不说中文。
kerem closed this issue 2026-02-26 02:33:14 +03:00
Author
Owner

@zhiayang commented on GitHub (Jul 9, 2017):

Ok, I'm closing this since I figured it out -- I'll leave it here for future reference:

So, getting to the 404, I augmented the existing try_files statement as such:

try_files					$uri $uri/ /index.php?$args /index.php$query_string;

What followed (for me) was an authentication error (401), so I simply deleted the koeldb database I had (DROP DATABASE koeldb; in SQL), and re-ran php artisan koel:init.

After that, it seems to work.

<!-- gh-comment-id:313905318 --> @zhiayang commented on GitHub (Jul 9, 2017): Ok, I'm closing this since I figured it out -- I'll leave it here for future reference: So, getting to the 404, I augmented the existing `try_files` statement as such: ``` try_files $uri $uri/ /index.php?$args /index.php$query_string; ``` What followed (for me) was an authentication error (`401`), so I simply deleted the `koeldb` database I had (`DROP DATABASE koeldb;` in SQL), and re-ran `php artisan koel:init`. After that, it seems to work.
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#444
No description provided.