[GH-ISSUE #771] NGINX: 502 Bad Gateway #557

Closed
opened 2026-02-26 02:33:33 +03:00 by kerem · 2 comments
Owner

Originally created by @ghost on GitHub (Jul 28, 2018).
Original GitHub issue: https://github.com/koel/koel/issues/771

Hello! I have an issue while trying to access koel with domain name on NGINX, it returns an error 502. I have tried to run php artisan serve --host 0.0.0.0 and then it didn't return en error, but it was a blank white screen with title in the tab koel.
P.S works fine when using my IP:8000. Could you help me, please?
My entire configuration of NGINX is taken from repo. So:

server {
  listen          *:80;
  server_name    example.com;
  root            /var/www/koel;
  index           index.php;

  #gzip            on;
  #gzip_types      text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
  #gzip_comp_level  9;

  # Whitelist only index.php, robots.txt, and those start with public/ or api/ or remote
  if ($request_uri !~ ^/$|index\.php|robots\.txt|api/|public/|remote) {
    return 404;
  }

  location /media/ {
    internal;

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

    #access_log /var/log/nginx/koel.access.log;
    #error_log  /var/log/nginx/koel.error.log;
  }

  location / {
    try_files   $uri $uri/ /index.php?$args;
  }

  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_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index             index.php;
    fastcgi_split_path_info   ^(.+\.php)(/.+)$;
    fastcgi_intercept_errors  on;
    include                   fastcgi_params;
  }
}

I have also tried changing fastcgi_pass 127.0.0.1:9000; to fastcgi_pass unix:/run/php/php7.0-fpm.sock;, but it didn't help.

Originally created by @ghost on GitHub (Jul 28, 2018). Original GitHub issue: https://github.com/koel/koel/issues/771 Hello! I have an issue while trying to access koel with domain name on NGINX, it returns an error 502. I have tried to run `php artisan serve --host 0.0.0.0` and then it didn't return en error, but it was a blank white screen with title in the tab koel. P.S works fine when using my IP:8000. Could you help me, please? My entire configuration of NGINX is taken from repo. So: ``` server { listen *:80; server_name example.com; root /var/www/koel; index index.php; #gzip on; #gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json; #gzip_comp_level 9; # Whitelist only index.php, robots.txt, and those start with public/ or api/ or remote if ($request_uri !~ ^/$|index\.php|robots\.txt|api/|public/|remote) { return 404; } location /media/ { internal; # A 'X-Media-Root' should be set to media_path settings from upstream alias $upstream_http_x_media_root; #access_log /var/log/nginx/koel.access.log; #error_log /var/log/nginx/koel.error.log; } location / { try_files $uri $uri/ /index.php?$args; } 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_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_intercept_errors on; include fastcgi_params; } } ``` I have also tried changing ` fastcgi_pass 127.0.0.1:9000;` to ` fastcgi_pass unix:/run/php/php7.0-fpm.sock;`, but it didn't help.
kerem closed this issue 2026-02-26 02:33:33 +03:00
Author
Owner

@sijanec commented on GitHub (Sep 14, 2018):

Quick TIP. If you are trying to connect outside of your LAN, check NAT connection settings, restore your router or check modified DNS settings.

If it is in your LAN, check DNS records on both machines and flush the cache. or DELETE them.

<!-- gh-comment-id:421326428 --> @sijanec commented on GitHub (Sep 14, 2018): Quick TIP. If you are trying to connect outside of your LAN, check NAT connection settings, restore your router or check modified DNS settings. If it is in your LAN, check DNS records on both machines and flush the cache. or DELETE them.
Author
Owner

@ghost commented on GitHub (Sep 14, 2018):

Already fixed that :) But still thx.

On Fri, 14 Sep 2018 at 13:12, Anton Šijanec notifications@github.com
wrote:

Quick TIP. If you are trying to connect outside of your LAN, check NAT
connection settings, restore your router or check modified DNS settings.

If it is in your LAN, check DNS records on both machines and flush the
cache. or DELETE them.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/phanan/koel/issues/771#issuecomment-421326428, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AV8ESByAbftUAiP41OmopuU5XXgMjXAhks5ua48egaJpZM4VlM8I
.

--
Sincerely, Andrei

Lep pozdrav, Andrei

С уважением, Андрей

My Blog https://andagent.com

<!-- gh-comment-id:421395171 --> @ghost commented on GitHub (Sep 14, 2018): Already fixed that :) But still thx. On Fri, 14 Sep 2018 at 13:12, Anton Šijanec <notifications@github.com> wrote: > Quick TIP. If you are trying to connect outside of your LAN, check NAT > connection settings, restore your router or check modified DNS settings. > > If it is in your LAN, check DNS records on both machines and flush the > cache. or DELETE them. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/phanan/koel/issues/771#issuecomment-421326428>, or mute > the thread > <https://github.com/notifications/unsubscribe-auth/AV8ESByAbftUAiP41OmopuU5XXgMjXAhks5ua48egaJpZM4VlM8I> > . > -- Sincerely, Andrei ------------------------------------ Lep pozdrav, Andrei ------------------------------------ С уважением, Андрей My Blog <https://andagent.com>
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#557
No description provided.