[英]Centos apache cannot access to mariadb
thanks for your time on my subject.感谢您花时间讨论我的主题。
I installed 2 servers with CentOS 7 into my local network.我在本地网络中安装了 2 台带有 CentOS 7 的服务器。 I can access from WEB to DB using mysql command line and access to the DB.
我可以使用 mysql 命令行从 WEB 访问数据库并访问数据库。 But, when i untar wordpress and configure DB ip address into config file, the wordpress webpage inform me that the DB server is not reachable.
但是,当我解压 wordpress 并将 DB ip 地址配置到配置文件中时,wordpress 网页通知我无法访问 DB 服务器。
I make several test, with hostname instead of IP address, i remove all firewall on both server, i made the wordpress installation using a local database on WEB server with success.我进行了几次测试,使用主机名而不是 IP 地址,我删除了两台服务器上的所有防火墙,我使用 WEB 服务器上的本地数据库成功安装了 wordpress。
I dump the database from WEB to DB and try to modify again the config file, i received the same error message that DB server is unreacheable.我将数据库从 WEB 转储到 DB 并尝试再次修改配置文件,我收到相同的错误消息,即 DB 服务器无法访问。
I made a tcpdump src WEBserv and look tcp package arrival, nothing come from WEBserv to DBserv when i refresh the wordpress index page.我做了一个 tcpdump src WEBserv 并查看 tcp package 到达,当我刷新 wordpress 索引页面时,没有任何东西来自 WEBserv 到 DBserv。 I try manual SQL connexion with WEBserver mysql to DBServ, the tcpdump catch the tcp package and connection is on success.
I try manual SQL connexion with WEBserver mysql to DBServ, the tcpdump catch the tcp package and connection is on success.
I look apache log (in debug level) to verify is apache webserv try to access to the DBserv and found this:我查看 apache 日志(在调试级别)以验证是 apache webserv 尝试访问 DBserv 并发现:
[root@nev-web1 httpd]# tail -f *
==> access_log <==
192.168.0.55 - - [06/Jan/2021:16:21:31 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:32 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:33 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:33 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:34 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:34 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:35 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:36 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:36 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
192.168.0.55 - - [06/Jan/2021:16:21:37 +0100] "GET / HTTP/1.1" 500 2609 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
==> error_log <==
[Wed Jan 06 16:21:37.192175 2021] [authz_core:debug] [pid 7291] mod_authz_core.c(809): [client 192.168.0.55:51165] AH01626: authorization result of <RequireAny>: granted
[Wed Jan 06 16:21:37.192188 2021] [proxy:debug] [pid 7291] mod_proxy.c(1123): [client 192.168.0.55:51165] AH01143: Running scheme fcgi handler (attempt 0)
[Wed Jan 06 16:21:37.192193 2021] [proxy_ajp:debug] [pid 7291] mod_proxy_ajp.c(722): [client 192.168.0.55:51165] AH00894: declining URL fcgi://127.0.0.1:9000/var/www/html/index.php
[Wed Jan 06 16:21:37.192196 2021] [proxy_fcgi:debug] [pid 7291] mod_proxy_fcgi.c(972): [client 192.168.0.55:51165] AH01076: url: fcgi://127.0.0.1:9000/var/www/html/index.php proxyname: (null) proxyport: 0
[Wed Jan 06 16:21:37.192199 2021] [proxy_fcgi:debug] [pid 7291] mod_proxy_fcgi.c(979): [client 192.168.0.55:51165] AH01078: serving URL fcgi://127.0.0.1:9000/var/www/html/index.php
[Wed Jan 06 16:21:37.192202 2021] [proxy:debug] [pid 7291] proxy_util.c(2209): AH00942: FCGI: has acquired connection for (*)
[Wed Jan 06 16:21:37.192206 2021] [proxy:debug] [pid 7291] proxy_util.c(2262): [client 192.168.0.55:51165] AH00944: connecting fcgi://127.0.0.1:9000/var/www/html/index.php to 127.0.0.1:9000
[Wed Jan 06 16:21:37.192258 2021] [proxy:debug] [pid 7291] proxy_util.c(2442): [client 192.168.0.55:51165] AH00947: connected /var/www/html/index.php to 127.0.0.1:9000
[Wed Jan 06 16:21:37.192307 2021] [proxy:debug] [pid 7291] proxy_util.c(2818): AH02824: FCGI: connection established with 127.0.0.1:9000 (*)
[Wed Jan 06 16:21:37.209737 2021] [proxy:debug] [pid 7291] proxy_util.c(2224): AH00943: FCGI: has released connection for (*)
So i think it's the WEB local proxy (for php7.2) that don't root the SQL connexion to DBserv, here the php-fpm.conf所以我认为是 WEB 本地代理(用于 php7.2)不将 SQL 连接到 DBserv,这里是 php-fpm.conf
[root@nev-web1 html]# cat /etc/httpd/conf.d/php-fpm.conf AddType
text/html .php DirectoryIndex index.php <FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch>
Please, let me know if you have an idea to unlock my situation.请让我知道您是否有解决我的情况的想法。 Best regards
此致
WEB: WEB:
[root@nev-web1 html]# rpm -q centos-release
centos-release-7-9.2009.1.el7.centos.x86_64
[root@nev-web1 html]# php -v
PHP 7.2.24 (cli) (built: Nov 4 2019 10:23:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24, Copyright (c) 1999-2018, by Zend Technologies
[root@nev-web1 html]# rpm -q httpd
httpd-2.4.6-97.el7.centos.x86_64
DB: D B:
[root@nev-web2 etc]# rpm -q centos-release
centos-release-7-9.2009.1.el7.centos.x86_64
Server version: 5.5.68-MariaDB MariaDB Server
WEB YUM LIST PHP WEB YUM 列表 PHP
[root@nev-web1 httpd]# grep php /tmp/yumlist
php-cli.x86_64 5.4.16-48.el7 @base
php-common.x86_64 5.4.16-48.el7 @base
rh-php72.x86_64 1-2.el7 @centos-sclo-rh
rh-php72-build.x86_64 1-2.el7 @centos-sclo-rh
rh-php72-php.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-bcmath.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-cli.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-common.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-dba.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-dbg.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-devel.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-embedded.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-enchant.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-fpm.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-gd.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-gmp.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-intl.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-json.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-ldap.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-mbstring.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-mysqlnd.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-odbc.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-opcache.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-pdo.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-pear.noarch 1:1.10.5-1.el7 @centos-sclo-rh
rh-php72-php-pecl-apcu.x86_64 5.1.12-1.el7 @centos-sclo-rh
rh-php72-php-pecl-apcu-devel.x86_64 5.1.12-1.el7 @centos-sclo-rh
rh-php72-php-pgsql.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-process.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-pspell.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-recode.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-snmp.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-soap.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-xml.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-xmlrpc.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-php-zip.x86_64 7.2.24-1.el7 @centos-sclo-rh
rh-php72-runtime.x86_64 1-2.el7 @centos-sclo-rh
rh-php72-scldevel.x86_64 1-2.el7 @centos-sclo-rh
setsebool -P httpd_can_network_connect=1 setsebool -P httpd_can_network_connect=1
It's works... =] Happy and sade in same time (3 days...)它的作品...... =]同时快乐和悲伤(3天......)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.