Ad Widget

Collapse

Running Zabbix Web UI with nginx and php-fpm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lxndrp
    Junior Member
    • Apr 2013
    • 1

    #1

    Running Zabbix Web UI with nginx and php-fpm

    Hi everyone,

    we are currently running Zabbix Web UI under Apache and would like to switch to nginx and php-fpm.

    Does anyone on the forum have a working configuration for this setup that he/she would share with me? I have searched the web for examples, but only found two (one russian, one japanese) which didn't really work.

    Thanks in advance,
    Alexander
  • Midnightfox
    Junior Member
    • Apr 2013
    • 4

    #2
    /usr/share/doc/zabbix-frontend-php/examples/nginx.conf

    (this is from the zabbix-frontend-php_2.0.6+dfsg-1_all.deb on the sid repo)

    Code:
    location /zabbix {
            if ($scheme ~ ^http:){
                rewrite ^(.*)$  https://$host$1 permanent;
            }
    	alias			/usr/share/zabbix;
    	index			index.php;
    	error_page		403 404 502 503 504  /zabbix/index.php;
    
    	location ~ \.php$ {
    		if (!-f $request_filename) { return 404; }
    		expires			epoch;
    		include			/etc/nginx/fastcgi_params;
    		fastcgi_index	index.php;
    		fastcgi_pass	unix:/var/run/php5-fpm.sock;
        }
    
    	location ~ \.(jpg|jpeg|gif|png|ico)$ {
    		access_log	off;
    		expires		33d;
    	}
    
    }

    Comment

    • HeinrichHaag
      Junior Member
      • Nov 2013
      • 2

      #3
      It works?

      Hey lxndrp!

      Did you try it? Is it worked fine for you?

      Comment

      • Midnightfox
        Junior Member
        • Apr 2013
        • 4

        #4
        Originally posted by HenriqueHaag
        Hey lxndrp!

        Did you try it? Is it worked fine for you?
        I'm currently using this configuration:

        nginx:
        Code:
        server {
                server_name zabbix.example.com;
                return 301 https://zabbix.example.com$request_uri;
        }
        
        server {
                listen 443;
                server_name zabbix.example.com;
                access_log  /var/log/nginx/zabbix.log;
                error_log  /var/log/nginx/zabbix.error;
                ssl on;
                ssl_certificate /etc/ssl/certs/zabbix.crt;
                ssl_certificate_key /etc/ssl/private/zabbix.key;
                root /var/www/zabbix/;
                index index.php index.html;
                client_max_body_size 5m;
                client_body_buffer_size 128k;
        
                location ~ \.php$ {
                        fastcgi_pass unix:/var/run/zabbix.socket;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
                }
        
                location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                        expires max;
                        log_not_found off;
                }
        
                location ~ /\.ht {
                deny all;
                }
        
                location ~ /\. {
                deny all;
                }
        }
        php-fpm:
        Code:
        [zabbix]
        user = www-data
        group = www-data
        
        listen = /var/run/zabbix.socket
        listen.owner = www-data
        listen.group = www-data
        
        pm = dynamic
        pm.max_children = 4
        pm.start_servers = 1
        pm.min_spare_servers = 1
        pm.max_spare_servers = 4
        php_value[post_max_size] = 16M
        php_value[max_execution_time] = 300
        php_value[max_input_time] = 300
        php_value[open_basedir] = /var/www/zabbix/:/usr/share/fonts/:/tmp

        Comment

        • fun_9990
          Junior Member
          • May 2017
          • 13

          #5
          now i get "404 Not Found" error message in front page

          my webserver is Nginx

          do you had this problem before ?

          and how can i resolve this problem ?

          service zabbix-server start
          service zabbix-agent start

          these commands successfully started and i don't know why this error occurred

          Comment

          • HeinrichHaag
            Junior Member
            • Nov 2013
            • 2

            #6
            Originally posted by fun_9990
            now i get "404 Not Found" error message in front page

            my webserver is Nginx

            do you had this problem before ?

            and how can i resolve this problem ?

            service zabbix-server start
            service zabbix-agent start

            these commands successfully started and i don't know why this error occurred
            Could you send us your nginx and php-fpm configuration files?

            Comment

            Working...