Nginx

Nginx, and Solutions.

502 Bad Gateway

:

:Nginx (, )

Solutions:

  1. : systemctl status app curl localhost:3000
  2. proxy_pass and
  3. PHP-FPM: socket and
  4. proxy_connect_timeout and proxy_read_timeout

:, systemd

403 Forbidden

:

:Nginx /

Solutions:

  1. : ls -la /var/www/html/
  2. Nginx ( www-data nginx)
  3. : chmod 644 files, chmod 755 directories
  4. : chown -R www-data:www-data /var/www/html/
  5. SELinux: getenforce, Enforcing

:,

nginx: [emerg] unknown directive / unexpected "}"

: nginx -t nginx -s reload

:Syntax(, )

Solutions:

  1. {}
  2. include
  3. nginx -T

: nginx -t, Nginx Syntax

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

: Nginx

:80 (Apache, Nginx )

Solutions:

  1. : sudo lsof -i :80 sudo ss -tlnp | grep :80
  2. : sudo systemctl stop apache2
  3. Nginx : sudo killall nginx
  4. : listen 8080;

: Web, Apache

504 Gateway Timeout / upstream timed out

: API

:Nginx proxy_read_timeout( 60s)

Solutions:

  1. : proxy_read_timeout 300s;
  2. : proxy_connect_timeout 60s; proxy_send_timeout 300s;
  3. ( ID, )

: API,