Apache-2.4
Zabbix 前端的 proxy_fcgi 和 php_fpm 沒有執行 PHP
我已經為 Zabbix 前端安裝了 php7.0-fpm 並啟用了 proxy_fcgi mod。
但是,當我嘗試從任何頁面訪問時,我會得到該頁面的 PHP 原始碼,而不是普通頁面。
我的配置是下一個:
/etc/php/7.0/fpm/pool.d/www.conf [www] user= www-data group = www-data listen = /run/php/php7.0-fpm.sock listen.owner = www-data listen.group = www-data listen.mode = 0660 pm = dynamic pm.max_children=10 pm.start_servers =5 pm.min_spare_servers = 2 pm.max_spare_servers = 7 chdir = /usr/share/zabbix/ /etc/apache2/sites-enabled/zabbix.conf <VirtualHost *:80> Include conf-available/zabbix.conf <FilesMatch \.php$> SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost/usr/share/zabbix/" </FilesMatch> </VirtualHost> Loaded Modules: core_module (static) so_module (static) watchdog_module (static) http_module (static) log_config_module (static) logio_module (static) version_module (static) unixd_module (static) access_compat_module (shared) actions_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) mime_module (shared) mpm_worker_module (shared) negotiation_module (shared) proxy_module (shared) proxy_fcgi_module (shared) setenvif_module (shared) status_module (shared)
在任何頁面訪問期間,我只獲得 php 原始碼:
<?php /* ** Zabbix ** Copyright (C) 2001-2017 Zabbix SIA ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(__FILE__).'/include/config.inc.php';
在日誌中,一切都很清楚,根本沒有錯誤。
能否請你幫忙?
**改變了。**看起來您的配置文件中存在錯誤,
SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost"
而不是SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost/usr/share/zabbix/"
.我在我的虛擬機上檢查它,一切正常。