久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      Zabbix替換默認Web服務器httpd為Nginx

      本身環(huán)境zabbix之前是采用的lamp環(huán)境rpm包去安裝zabbix的?,F(xiàn)在要換成nginx做為web服務。

      替換思路 : zabbix的web服務是用php寫的,httpd 只是一個web服務器。有了替換思路我們就進行下一步,我們首先找到php程序存放的目錄。

      找到zabbix.conf并打開文件 /etc/httpd/conf.d/zabbix.conf,根據(jù)路徑來看不難判斷這個文件應該就是httpd配置文件,打開文件根據(jù)Directory可以判    斷/usr/share/zabbix為程序所在目錄。

      找到zabbix程序所在目錄后,我們就著手配置nginx就好了,進入nginx的配置目錄并打開 /etc/nginx/conf.d/default.conf文件(或者另外創(chuàng)建一個zabbix.conf 的文件)

      安裝好lnmp環(huán)境,nginx是基于php-fpm,rhel7.4只有php相關(guān)rpm包,但沒有php-fpm的rpm包,所以需要自己下載相應版本的php-fpm的rpm包并安裝,

      zabbix不想放在網(wǎng)站根目錄下,這樣不容易和網(wǎng)站應用混在一起,這樣zabbix的目錄就放在別處,在Apache里,有alias,比較方便,在Nginx下沒有虛擬目錄概念的,是用location配合alias使用,但使用alias標簽的目錄塊中不能使用rewrite的break。我先試了簡單的配置方式:

      編輯default.conf為下面的內(nèi)容:

      一、采用別名配置方法一:

      # vi /etc/nginx/conf.d/default.conf
      server {
          listen      80;
          server_name  localhost;
          #charset koi8-r;
          #access_log  /var/log/nginx/host.access.log  main;
         
      采用別名zabbix方式:http://IP/zabbix,這樣去訪問,就不用nginx默認/目錄了
          location /zabbix {
              alias  /usr/share/zabbix;  #是zabbix前端的PHP文件所在目錄
              index  index.html index.htm index.php;
          }
         
         
          #設(shè)置下面幾個目錄 不允許外部訪問
          location ^~ /app {
              deny all;
          }
         
          location ^~ /conf {
              deny all;
          }
         
          location ^~ /local {
              deny all;
          }
         
          location ^~ /include {
              deny all;
          }
         
         
          #error_page  404              /404.html;
          # redirect server error pages to the static page /50x.html
          #
          error_page  500 502 503 504  /50x.html;
          location = /50x.html {
              root  /usr/share/nginx/html;
          }
         
          # proxy the PHP scripts to Apache listening on 127.0.0.1:80
          #
          #location ~ .php$ {
          #    proxy_pass  http://127.0.0.1;
          #}
         
          # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
          #
         
          # 配置nginx和php-fpm通信
          # 我們使用端口的形式來進行通訊
          # 前面注釋去掉并修改成你需要的
          location ~ ^/zabbix/.+.php$ {
              #fastcgi_split_path_info ^(.+.php)(/.+)$;
              fastcgi_pass  127.0.0.1:9000;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME  /usr/share$fastcgi_script_name;
              include        fastcgi_params;
          }
         
          # deny access to .htaccess files, if Apache’s document root
          # concurs with nginx’s one
          #
          #location ~ /.ht {
          #    deny  all;
          #}
      }

      配置好之后保存文件

      啟動服務:

      systemctl start php-fpm
      systemctl restart nginx
      systemctl restart zabbix-server zabbix-agent

      開機啟動:

      systemctl enable php-fpm
      systemctl enable zabbix-server zabbix-agent nginx

      二、采用別名配置方法二:

      # vi /etc/nginx/conf.d/default.conf
      server {
          listen      80;
          server_name  localhost;
          #charset koi8-r;
          #access_log  /var/log/nginx/host.access.log  main;
         
         
          location /zabbix {
              alias  /usr/share/zabbix;
              index  index.html index.htm index.php;
          }
         
          #設(shè)置下面幾個目錄 不允許外部訪問
          location ^~ /app {
              deny all;
          }
         
          location ^~ /conf {
              deny all;
          }
         
          location ^~ /local {
              deny all;
          }
         
          location ^~ /include {
              deny all;
          }
         
          #error_page  404              /404.html;
          # redirect server error pages to the static page /50x.html
          #
          error_page  500 502 503 504  /50x.html;
          location = /50x.html {
              root  /usr/share/nginx/html;
          }
         
          # proxy the PHP scripts to Apache listening on 127.0.0.1:80
          #
          #location ~ .php$ {
          #    proxy_pass  http://127.0.0.1;
          #}
         
          # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
          #
          # 配置nginx和php-fpm通信
          # 我們使用端口的形式來進行通訊
          #此方法二原理應該是采用rewrite的方法,對于/zabbix/下php類型的的請求交給后端的FastCGI處理,
            #并且指定了php腳本的位置,這樣我們就可以配置zabbix了,配置如下:
          location ~ ^/zabbix/.+.php$ {
              root /usr/share;
              rewrite /zabbix/(.*.php?) /$1 break;
              fastcgi_pass  127.0.0.1:9000;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME  /usr/share/zabbix$fastcgi_script_name;
              include        fastcgi_params;
          }
         
          location ~ .*.(php|php5)?$ {
              fastcgi_pass  127.0.0.1:9000;
              fastcgi_index index.php;
          }
         
          # deny access to .htaccess files, if Apache’s document root
          # concurs with nginx’s one
          #
          #location ~ /.ht {
          #    deny  all;
          #}
         
      }

      要注意的是:
      location ~ .*.(php|php5)?$ {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
      }

      這段,要放在location ~ ^/zabbix/.+.php$的后面,放在前面就有問題,這是和Nginx的location規(guī)則有關(guān),具體看Nginx的文檔,
      另外,zabbix里要配置一下URI的絕對路徑,就可以了。

      三、訪問zabbix服務:http:/IP/zabbix

      Zabbix替換默認Web服務器httpd為Nginx

      到上面為止,我們就替換zabbix默認web服務器httpd為nginx。但是我們還沒有結(jié)束,是的,還沒有結(jié)束?。。?/p>

      我們登錄后可能會出現(xiàn)如下報錯,這個是需要設(shè)置php.ini參數(shù)date.timezone設(shè)置php的默認時區(qū),設(shè)置好后點重試,即可打開首頁了

      Zabbix替換默認Web服務器httpd為Nginx

      當跳轉(zhuǎn)到首頁,右下角dashboard模塊下 Status of Zabbix 有幾個紅色的異常

      Zabbix替換默認Web服務器httpd為Nginx

      1、date.timezone => 沒有設(shè)置php的默認時區(qū)

      2、max_input_time 60

      3、max_execution_time 30

      4、post_max_size    8M   

      這四個是php配置問題,我們只需要編輯php.ini就好了

      #vi /etc/php.ini
      post_max_size = 16M
      max_input_time = 300
      max_execution_time = 300
      date.timezone = Asia/Shanghai

      到這里完成結(jié)束了。

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號