Ad Widget

Collapse

Obtengo un error 502 NGINX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hook69
    Junior Member
    • Jun 2018
    • 9

    #1

    Obtengo un error 502 NGINX

    Buenos días,
    he hecho varias instalaciones de zabbix con otras webs en el mismo server, siempre sin problemas con apache.
    En este caso, tiene NGINX instalado, y no entiendo porque obtengo el error 502 Bad Gateway. Creo que tengo correctamente configurados los ficheros.
    /etc/nginx/conf.d/zabbix.empresa.net.conf
    PHP Code:
    server {
            
    listen          80;
            
    server_name     zabbix.empresa.net;

            
    root    /usr/share/zabbix;

            
    index   index.php;

            
    location = /favicon.ico {
                    
    log_not_found   off;
            }

            
    location / {
                    
    try_files       $uri $uri/ =404;
            }

            
    location /assets {
                    
    access_log      off;
                    
    expires         10d;
            }

            
    location ~ /\.ht {
                    
    deny            all;
            }

            
    location ~ /(api\/|conf[^\.]|include|locale) {
                    
    deny            all;
                    return          
    404;
            }

            
    location /vendor {
                    
    deny            all;
                    return          
    404;
            }

            
    location ~ [^/]\.php(/|$) {
                    
    fastcgi_pass    unix:/var/run/php/zabbix.sock;
                    
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    
    fastcgi_index   index.php;

                    
    fastcgi_param   DOCUMENT_ROOT   /usr/share/zabbix;
                    
    fastcgi_param   SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
                    
    fastcgi_param   PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;

                    include 
    fastcgi_params;
                    
    fastcgi_param   QUERY_STRING    $query_string;
                    
    fastcgi_param   REQUEST_METHOD  $request_method;
                    
    fastcgi_param   CONTENT_TYPE    $content_type;
                    
    fastcgi_param   CONTENT_LENGTH  $content_length;

                    
    fastcgi_intercept_errors        on;
                    
    fastcgi_ignore_client_abort     off;
                    
    fastcgi_connect_timeout         60;
                    
    fastcgi_send_timeout            180;
                    
    fastcgi_read_timeout            180;
                    
    fastcgi_buffer_size             128k;
                    
    fastcgi_buffers                 4 256k;
                    
    fastcgi_busy_buffers_size       256k;
                    
    fastcgi_temp_file_write_size    256k;
            }

    En el fichero de configuración de nginx, está el include de la carpeta del conf.d
    sudo vi /etc/nginx/nginx.conf

    PHP Code:
    user  nginx;
    worker_processes  auto;

    error_log  /var/log/nginx/error.log notice;
    pid        /var/run/nginx.pid;


    events {
        
    worker_connections  1024;
    }


    http {
        include       /
    etc/nginx/mime.types;
        
    default_type  application/octet-stream;

        
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"'
    ;

        
    access_log  /var/log/nginx/access.log  main;

        
    sendfile        on;
        
    #tcp_nopush     on;

        
    server_tokens off;

        
    keepalive_timeout  65;

        
    #gzip  on;

        
    include /etc/nginx/conf.d/*.conf;
    }
    ​ 

    La carpeta de instalación por defecto de zabbix
    ll /usr/share/zabbix
    PHP Code:
    drwxr-xr-x  15 root root  4096 May  7 07:02 ./
    drwxr-xr-x 133 root root  4096 May  7 07:02 ../
    -
    rw-r--r--   1 root root  2363 Apr 22 08:11 api_jsonrpc.php
    -rw-r--r--   1 root root  1799 Apr 22 08:11 api_scim.php
    drwxr
    -xr-x   5 root root  4096 May  7 07:02 app/
    drwxr-xr-x   5 root root  4096 May  7 07:02 assets/
    drwxr-xr-x   2 root root  4096 May  7 07:02 audio/
    -
    rw-r--r--   1 root root  1491 Apr 22 08:11 browserwarning.php
    -rw-r--r--   1 root root  4533 Apr 22 08:54 chart.php
    -rw-r--r--   1 root root  5119 Apr 22 08:54 chart2.php
    -rw-r--r--   1 root root  7034 Apr 22 08:54 chart3.php
    -rw-r--r--   1 root root  5633 Apr 22 08:11 chart4.php
    -rw-r--r--   1 root root  3620 Apr 22 08:54 chart6.php
    -rw-r--r--   1 root root  3960 Apr 22 08:54 chart7.php
    -rw-r--r--   1 root root   300 Apr 22 08:54 composer.json
    -rw-r--r--   1 root root  8010 Apr 22 08:54 composer.lock
    drwxr
    -xr-x   3 root root  4096 May  7 07:02 conf/
    drwxr-xr-x   2 root root  4096 May  7 07:02 data/
    -
    rw-r--r--   1 root root 28177 Apr 22 08:54 disc_prototypes.php
    -rw-r--r--   1 root root 32988 Apr 22 08:11 favicon.ico
    drwxr
    -xr-x   2 root root  4096 Apr 22 08:55 fonts/
    -
    rw-r--r--   1 root root 25185 Apr 22 08:54 graphs.php
    -rw-r--r--   1 root root  5014 Apr 22 08:54 history.php
    -rw-r--r--   1 root root 36297 Apr 22 08:54 host_discovery.php
    -rw-r--r--   1 root root 22058 Apr 22 08:54 host_prototypes.php
    -rw-r--r--   1 root root  9111 Apr 22 08:54 hostinventories.php
    -rw-r--r--   1 root root  6371 Apr 22 08:11 hostinventoriesoverview.php
    -rw-r--r--   1 root root 29592 Apr 22 08:54 httpconf.php
    -rw-r--r--   1 root root  6478 Apr 22 08:11 httpdetails.php
    -rw-r--r--   1 root root  1856 Apr 22 08:11 image.php
    -rw-r--r--   1 root root  3576 Apr 22 08:54 imgstore.php
    drwxr
    -xr-x   4 root root  4096 May  7 07:02 include/
    -
    rw-r--r--   1 root root  3959 Apr 22 08:54 index.php
    -rw-r--r--   1 root root  3032 Apr 22 08:11 index_http.php
    -rw-r--r--   1 root root 11702 Apr 22 08:11 index_sso.php
    -rw-r--r--   1 root root 53567 Apr 22 08:54 items.php
    drwxr
    -xr-x   5 root root  4096 May  7 07:02 js/
    -
    rw-r--r--   1 root root 17842 Apr 22 08:54 jsLoader.php
    -rw-r--r--   1 root root 25433 Apr 22 08:54 jsrpc.php
    drwxr
    -xr-x   4 root root  4096 May  7 07:02 local/
    drwxr-xr-x  40 root root  4096 May  7 07:02 locale/
    -
    rw-r--r--   1 root root  1914 Apr 22 08:11 map.php
    drwxr
    -xr-x   2 root root  4096 Apr 22 08:54 modules/
    -
    rw-r--r--   1 root root 18442 Apr 22 08:54 report2.php
    -rw-r--r--   1 root root  7313 Apr 22 08:54 report4.php
    -rw-r--r--   1 root root   974 Apr 22 08:11 robots.txt
    -rw-r--r--   1 root root  6952 Apr 22 08:11 setup.php
    -rw-r--r--   1 root root 10794 Apr 22 08:54 sysmap.php
    -rw-r--r--   1 root root 16431 Apr 22 08:54 sysmaps.php
    -rw-r--r--   1 root root 29980 Apr 22 08:54 templates.php
    -rw-r--r--   1 root root  6696 Apr 22 08:54 toptriggers.php
    -rw-r--r--   1 root root  6749 Apr 22 08:54 tr_events.php
    -rw-r--r--   1 root root 25206 Apr 22 08:54 trigger_prototypes.php
    -rw-r--r--   1 root root 34754 Apr 22 08:54 triggers.php
    drwxr
    -xr-x   7 root root  4096 May  7 07:02 vendor/
    drwxr-xr-x  26 root root  4096 May  7 07:02 widgets/
    -
    rw-r--r--   1 root root   842 Apr 22 08:11 zabbix.php
    ​ 
    y el /var/log/nginx/error.log
    PHP Code:
    2024/05/20 07:32:58 [notice175590#175590: start worker processes
    2024/05/20 07:32:58 [notice175590#175590: start worker process 175591
    2024/05/20 07:33:06 [crit175591#175591: *9 connect() to unix:/var/run/php/zabbix.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.250.254, server: zabbix.empresa.net, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/zabbix.sock:", host: "zabbix.empresa.net"
    2024/05/20 07:33:07 [crit175591#175591: *9 connect() to unix:/var/run/php/zabbix.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.250.254, server: zabbix.empresa.net, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/zabbix.sock:", host: "zabbix.empresa.net"
    ​ 
    Podríais echarme un cable?

    gracias
    Last edited by hook69; 20-05-2024, 10:09.
  • solution
    Senior Member
    • Jun 2020
    • 269

    #2
    ¿Es esta la path del socket php?
    ..connect() a Unix:/var/run/php/zabbix.sock failed..
    Verifique su configuración de php-fpm.

    reinicie si es necesario.
    Mira esta publicación, tal vez te ayude.
    Hi, i have use the following steps to do the task but encounter php-pfm not installed or version is different: mkdir -p /var/run/php-fpm yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum install -y nginx yum install -y yum-utils vi /etc/yum/pluginconf.d/subscription-manager.conf : enabled=0 yum-config-manager --disable remi-php54 yum-config-manager --enable remi-php73 yum install php-fpm i have tried two ways to install php-pfm second way is following: dnf ...


    Wellington

    Comment

    Working...