Ad Widget

Collapse

install zabbix 4.4 nginx error 404

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bognad
    Junior Member
    • Nov 2018
    • 9

    #1

    install zabbix 4.4 nginx error 404

    Hi everyone. I trying to do a Zabbix 4.4 install on a CentOS 7 and Postgresql and NGinx.
    I'm following the instruction
    https://www.zabbix.com/documentation...es/rhel_centos
    After install i get 404 error on nginx
    What can i do with nginx config or zabbix.conf or something else?
    selinux is disabled.



    Code:
    [SIZE=11px]cat /etc/nginx/nginx.conf
    # For more information on configuration, see:
    #   * Official English Documentation: http://nginx.org/en/docs/
    #   * Official Russian Documentation: http://nginx.org/ru/docs/
    
    user nginx;
    worker_processes auto;
    error_log /var/log/nginx/error.log;
    pid /run/nginx.pid;
    
    # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;
    
    events {
        worker_connections 1024;
    }
    
    http {
        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;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 2048;
    
        include             /etc/nginx/mime.types;
        default_type        application/octet-stream;
    
        # Load modular configuration files from the /etc/nginx/conf.d directory.
        # See http://nginx.org/en/docs/ngx_core_module.html#include
        # for more information.
        include /etc/nginx/conf.d/*.conf;
    
        server {
            listen       80 default_server;
            listen       [::]:80 default_server;
            server_name  _;
            root         /usr/share/nginx/html;
    
            # Load configuration files for the default server block.
            include /etc/nginx/default.d/*.conf;
    
            location / {
            }
    
            error_page 404 /404.html;
                location = /40x.html {
            }
    
            error_page 500 502 503 504 /50x.html;
                location = /50x.html {
            }
        }
    
    # Settings for a TLS enabled server.
    #
    #    server {
    #        listen       443 ssl http2 default_server;
    #        listen       [::]:443 ssl http2 default_server;
    #        server_name  _;
    #        root         /usr/share/nginx/html;
    #
    #        ssl_certificate "/etc/pki/nginx/server.crt";
    #        ssl_certificate_key "/etc/pki/nginx/private/server.key";
    #        ssl_session_cache shared:SSL:1m;
    #        ssl_session_timeout  10m;
    #        ssl_ciphers HIGH:!aNULL:!MD5;
    #        ssl_prefer_server_ciphers on;
    #
    #        # Load configuration files for the default server block.
    #        include /etc/nginx/default.d/*.conf;
    #
    #        location / {
    #        }
    #
    #        error_page 404 /404.html;
    #            location = /40x.html {
    #        }
    #
    #        error_page 500 502 503 504 /50x.html;
    #            location = /50x.html {
    #        }
    #    }
    
    }[/SIZE]
    Code:
    [SIZE=11px]cat  /etc/nginx/conf.d/zabbix.conf
    server {
            listen          80;
            server_name     localhost;
    
            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 ~ [^/]\.php(/|$) {
                    fastcgi_pass    unix:/run/php-fpm/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;
            }
    }[/SIZE]


    Code:
    [SIZE=11px]cat /etc/php-fpm.d/zabbix.conf
    
    [zabbix]
    user = apache
    group = apache
    
    listen = /run/php-fpm/zabbix.sock
    listen.owner = nginx
    listen.allowed_clients = 127.0.0.1
    
    pm = dynamic
    pm.max_children = 50
    pm.start_servers = 5
    pm.min_spare_servers = 5
    pm.max_spare_servers = 35
    
    php_value[session.save_handler] = files
    php_value[session.save_path]    = /var/lib/php/session
    
    php_value[max_execution_time] = 300
    php_value[memory_limit] = 128M
    php_value[post_max_size] = 16M
    php_value[upload_max_filesize] = 2M
    php_value[max_input_time] = 300
    php_value[max_input_vars] = 10000
    php_value[date.timezone] = Europe/Riga[/SIZE]
    Attached Files
    Last edited by Bognad; 31-01-2020, 14:07.
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    Did you try the zabbix.com/download page instructions? https://www.zabbix.com/download?zabb...mysql&ws=nginx

    Comment

    • Bognad
      Junior Member
      • Nov 2018
      • 9

      #3
      Originally posted by dimir
      Did you try the zabbix.com/download page instructions? https://www.zabbix.com/download?zabb...mysql&ws=nginx
      Thanks for answering!
      Yes i tried.
      I find out some files has apache permissions:

      Code:
      [root@amzabbix user]# ls -lg /etc/zabbix/ | grep apache
      drwxr-x---. 2 apache    32 Jan 23 10:33 web

      apache in /etc/php-fpm.d/zabbix.conf:

      Code:
      [root@amzabbix user]# cat /etc/php-fpm.d/zabbix.conf
      [zabbix]
      user = apache
      group = apache

      Comment

      • dimir
        Zabbix developer
        • Apr 2011
        • 1080

        #4
        This might be related https://support.zabbix.com/browse/ZBX-17163

        Comment

        • Bognad
          Junior Member
          • Nov 2018
          • 9

          #5
          Originally posted by dimir
          Thanks for answering!

          Comment

          • yuriii
            Zabbix developer
            Zabbix Certified Specialist
            • Jan 2019
            • 3

            #6
            Make sure you have zabbix-nginx-conf installed.
            Edit /etc/nginx/conf.d/zabbix.conf file and configure listen / server_name directives.
            Either set you domain in server_name, then it will work just like a virtual host on apache.
            Or if you don't have DNS and just want to play on localhost, change the port to something other than 80.
            Because nginx has a default server running under localhost:80 and will fail to start if you use that for zabbix.
            In any case with nginx the frontend is accessed without /zabbix subdirectory as it is done with apache.

            I find out some files has apache permissions:
            Yes php-fpm runs as user apache by default. So does our pool for zabbix.
            This is done so that the same web apps could run with both apache or nginx without you having to change any permissions.

            Comment

            • Bognad
              Junior Member
              • Nov 2018
              • 9

              #7
              Originally posted by yuriii
              Make sure you have zabbix-nginx-conf installed.
              Edit /etc/nginx/conf.d/zabbix.conf file and configure listen / server_name directives.
              Either set you domain in server_name, then it will work just like a virtual host on apache.
              Or if you don't have DNS and just want to play on localhost, change the port to something other than 80.
              Because nginx has a default server running under localhost:80 and will fail to start if you use that for zabbix.
              In any case with nginx the frontend is accessed without /zabbix subdirectory as it is done with apache.


              Yes php-fpm runs as user apache by default. So does our pool for zabbix.
              This is done so that the same web apps could run with both apache or nginx without you having to change any permissions.
              Thanks, i'll check this

              Comment

              • LeonDirks
                Junior Member
                • Mar 2020
                • 2

                #8
                Hello,

                I am having the same problem and after some digging I think I found it, but I am not sure how to solve it.

                If you make a folder in your /usr/share/zabbix called zabbix (ie. /usr/share/zabbix/zabbix) and put a dummy index.php in it, like so:
                Code:
                <?php echo '<p>Hello World</p>'; ?>
                You will be able to load the dummy page. It looks like NGINX is sending zabbix/index.php instead of index.php as the script name.

                Also the installation guide on the Zabbix website forgets to install the "zabbix-web-mysql" and "zabbix-nginx-conf" packages.

                Mvg,

                Léon Dirks





                Comment

                • LeonDirks
                  Junior Member
                  • Mar 2020
                  • 2

                  #9
                  Small update

                  After some more playing I found that http://<serverip>/ doesn't work, but http://<serverip>/index.php does. Which is weird as I was expecting http://<serverip>/zabbix to work




                  Comment

                  • Colo2n
                    Junior Member
                    • Mar 2020
                    • 1

                    #10
                    Enter the password for the zabbix MySQL user that you configured when prompted. This command will not output any errors if it was successful UPSers.
                    Last edited by Colo2n; 24-03-2020, 13:59.

                    Comment

                    Working...