使用OpenSUSE v15.2, Apache.
使用zypper安装了PHP-FPM。遵循本网站上的说明:https://en.opensuse.org/SDB:Apache_FastCGI_and_PHP-FPM_配置
我重新启动了Apache和PHP-FPM。但是,网站未加载到浏览器中。
我得到HTTP错误502。
#############################################################################################################
还将获取此错误:
McAfee Web Gateway - Notification
Cannot Connect
The proxy could not connect to the destination in time.
URL:
_____________________________________________________________________________________________________
generated 2020-08-02 15:00:37 by McAfee Web Gateway
Lynx/2.8.9dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/1.1.1d
可能只是防火墙问题?
或者错误在我的Apache/PHP-FPM配置中?
/etc/apache2/vhosts.d/mysite.conf
<VirtualHost 10.20.30.40:80>
ServerAdmin webmaster@localhost
ServerName devsite.com
DocumentRoot /srv/www/mydir
# RewriteEngine On
# RewriteRule ^(.*)$ https://devsite.com$1 [L,R=301]
# ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/mydir$1
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /srv/www/mydir/>
Options FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
AccessFileName .htaccess
ErrorLog /var/log/apache2/myhost.err
CustomLog /var/log/apache2/myhost.acs combined
LogLevel warn
</VirtualHost>
我尝试在本地用Lynx浏览器调试问题,得到了这样的结果:
lynx 127.0.0.1:9000
Looking up 127.0.0.1 first
Looking up 127.0.0.1:9000
Making HTTP connection to 127.0.0.1:9000
Sending HTTP request.
HTTP request sent; waiting for response.
Retrying as HTTP0 request.
Looking up 127.0.0.1:9000
Making HTTP connection to 127.0.0.1:9000
Sending HTTP request.
HTTP request sent; waiting for response.
Alert!: Unexpected network read error; connection aborted.
Can't Access `http://127.0.0.1:9000/'
Alert!: Unable to access document.
lynx: Can't access startfile
也试过
lynx http://127.0.0.1/info.php
Looking up 127.0.0.1 first
Looking up 127.0.0.1
Making HTTP connection to 127.0.0.1
Sending HTTP request.
HTTP request sent; waiting for response.
HTTP/1.1 200 OK
它执行phpinfo()。php没有执行,只是提供了信息。php下载。因此php不会被解释。
PHP-FPM日志:
tail -f /var/log/php-fpm.log
[02-Aug-2020 01:37:29] NOTICE: Terminating ...
[02-Aug-2020 01:37:29] NOTICE: exiting, bye-bye!
[02-Aug-2020 01:37:29] NOTICE: fpm is running, pid 8099
[02-Aug-2020 01:37:29] NOTICE: ready to handle connections
[02-Aug-2020 01:37:29] NOTICE: systemd monitor interval set to 10000ms
[02-Aug-2020 01:39:47] NOTICE: Terminating ...
[02-Aug-2020 01:39:47] NOTICE: exiting, bye-bye!
[02-Aug-2020 01:39:47] NOTICE: fpm is running, pid 8202
[02-Aug-2020 01:39:47] NOTICE: ready to handle connections
[02-Aug-2020 01:39:47] NOTICE: systemd monitor interval set to 10000ms
显示它正在运行,并显示重新启动,仅此而已。
Apache错误日志:
tail -f /var/log/apache2/error_log
[Sun Aug 02 01:37:34.743959 2020] [mpm_prefork:notice] [pid 6160] AH00170: caught SIGWINCH, shutting down gracefully
AH00557: httpd-prefork: apr_sockaddr_info_get() failed for myhost
AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
[Sun Aug 02 01:37:34.818193 2020] [mpm_prefork:notice] [pid 8113] AH00163: Apache/2.4.43 (Linux/SUSE) OpenSSL/1.1.1d configured -- resuming normal operations
[Sun Aug 02 01:37:34.818251 2020] [core:notice] [pid 8113] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D SSL -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
[Sun Aug 02 01:39:45.771523 2020] [mpm_prefork:notice] [pid 8113] AH00170: caught SIGWINCH, shutting down gracefully
AH00557: httpd-prefork: apr_sockaddr_info_get() failed for myhost
AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
[Sun Aug 02 01:39:45.852536 2020] [mpm_prefork:notice] [pid 8186] AH00163: Apache/2.4.43 (Linux/SUSE) OpenSSL/1.1.1d configured -- resuming normal operations
[Sun Aug 02 01:39:45.852586 2020] [core:notice] [pid 8186] AH00094: Command line: '/usr/sbin/httpd-prefork -D SYSCONFIG -D SSL -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconfig.d//global.conf -f /etc/apache2/httpd.conf -c Include /etc/apache2/sysconfig.d//include.conf -D SYSTEMD -D FOREGROUND'
www.conf我启用了
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
但是没有/var/log/fpm php。创建了www.log。
Apache信息:
apachectl -S
VirtualHost configuration:
10.20.30.40:80 mysite.com (/etc/apache2/vhosts.d/myhost.conf:1)
*:443 mysite.com (/etc/apache2/vhosts.d/myhost.ssl.conf:1)
ServerRoot: "/srv/www"
Main DocumentRoot: "/srv/www/htdocs"
Main ErrorLog: "/var/log/apache2/error_log"
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
PidFile: "/var/run/httpd.pid"
Define: SYSCONFIG
Define: SSL
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="wwwrun" id=471
Group: name="www" id=471
/etc/apache2/conf.d/mod_fcgid.conf:
<IfModule fcgid_module>
FcgidIPCDir /var/lib/apache2/fcgid/
FcgidProcessTableFile /var/lib/apache2/fcgid/shm
# <FilesMatch "\.php$">
# SetHandler "proxy:fcgi://localhost/"
# SetHandler "proxy:fcgi://127.0.0.1:9000/"
# </FilesMatch>
</IfModule>
/etc/php7/fpm/php-fpm。形态
[global]
include=/etc/php7/fpm/php-fpm.d/*.conf
/etc/php7/fpm/php-fpm.d/www.conf
[www]
user = wwwrun
group = www
listen = 127.0.0.1:9000
listen.owner = wwwrun
listen.group = www
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on
/etc/apache2/sysconfig。d/loadmodule。形态
# File generated from /etc/sysconfig/apache2, do not edit. Edit the sysconfig file instead.
LoadModule actions_module /usr/lib64/apache2-prefork/mod_actions.so
LoadModule alias_module /usr/lib64/apache2-prefork/mod_alias.so
LoadModule auth_basic_module /usr/lib64/apache2-prefork/mod_auth_basic.so
LoadModule authn_core_module /usr/lib64/apache2-prefork/mod_authn_core.so
LoadModule authn_file_module /usr/lib64/apache2-prefork/mod_authn_file.so
LoadModule authz_host_module /usr/lib64/apache2-prefork/mod_authz_host.so
LoadModule authz_groupfile_module /usr/lib64/apache2-prefork/mod_authz_groupfile.so
LoadModule authz_core_module /usr/lib64/apache2-prefork/mod_authz_core.so
LoadModule authz_user_module /usr/lib64/apache2-prefork/mod_authz_user.so
LoadModule autoindex_module /usr/lib64/apache2-prefork/mod_autoindex.so
LoadModule cgi_module /usr/lib64/apache2-prefork/mod_cgi.so
LoadModule dir_module /usr/lib64/apache2-prefork/mod_dir.so
LoadModule env_module /usr/lib64/apache2-prefork/mod_env.so
LoadModule expires_module /usr/lib64/apache2-prefork/mod_expires.so
LoadModule include_module /usr/lib64/apache2-prefork/mod_include.so
LoadModule log_config_module /usr/lib64/apache2-prefork/mod_log_config.so
LoadModule mime_module /usr/lib64/apache2-prefork/mod_mime.so
LoadModule negotiation_module /usr/lib64/apache2-prefork/mod_negotiation.so
LoadModule setenvif_module /usr/lib64/apache2-prefork/mod_setenvif.so
LoadModule ssl_module /usr/lib64/apache2-prefork/mod_ssl.so
LoadModule socache_shmcb_module /usr/lib64/apache2-prefork/mod_socache_shmcb.so
LoadModule userdir_module /usr/lib64/apache2-prefork/mod_userdir.so
LoadModule reqtimeout_module /usr/lib64/apache2-prefork/mod_reqtimeout.so
LoadModule rewrite_module /usr/lib64/apache2-prefork/mod_rewrite.so
LoadModule proxy_module /usr/lib64/apache2-prefork/mod_proxy.so
LoadModule proxy_fcgi_module /usr/lib64/apache2-prefork/mod_proxy_fcgi.so
有什么问题吗?
要修复以下错误,首先尝试使用本地主机作为服务器名称,并在本地测试。(希望你有一个工作index.php可以给出一些回应)
AH00558:httpd prefork:无法使用127.0可靠地确定服务器的完全限定域名。0.1. 全局设置“ServerName”指令以抑制此消息
要首先将请求传递给php fpm,您需要在Apache上启用以下模块
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
然后尝试在中添加以下内容
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1
我正在努力理解我的错误在哪里。我看了各种答案并尝试了补救措施,结果发现他们的解决方案并没有纠正我的问题。我已经将所有内容剥离到最基本的部分,看看是否可以得到一个基本的PHP索引。php来展示自己。 以下是我试图在核心实现的目标: 我有docker compose站在1个网络上,2个服务连接到网络上。一个服务是PHP-FPM,另一个是为PHP-FPM服务的nginx。每次我站起来,不管我如何配置它,
我花了几个小时在这个问题上,尽管相关帖子很多,但我无法解决它。我有一个Fedora 20盒与Nginx PHP-FPM,直到今天工作得很好(在我重新加载php-fpm.service我猜)。Nginx提供的静态文件没有问题,但是任何PHP文件都会触发错误403。 权限正常,nginx和php fpm在用户“nginx”下运行: 服务的文件也被设置为nginx用户,我甚至结束了chmoding 77
本文向大家介绍解决启动php-fpm后访问不到php文件的办法,包括了解决启动php-fpm后访问不到php文件的办法的使用技巧和注意事项,需要的朋友参考一下 问题场景: linux系统 nginx服务器 安装好了fpm的php7 在nginx的web目录下新建了index.php文件,内容为phpinfo()函数。(如果是源码安装,位置一般为 /usr/local/nginx/html/inde
内网搭建后 加入端口访问 不可行吗 公司要求必须加入端口访问内网,然而现在目前再用的网站做迁移的时候发现很多端口 我批量开启后 测试无法访问 路由器映射 已经完成 公司用的专线 有动态公网地址 外网中可以访问面板地址也可以正常操作 唯独部署的 项目端口无法访问 ng的80端口 没动 创建的空间端口 8080 1070 这种 也无法访问 折腾不来
我想在机器上用docker设置一个完整的LNMP环境。但是分离的php fpm有一些问题 我所做的是: > 从docker.io拉取图像: docker pull php:7.1-fpm docker pull nginx 运行图像: docker run-d——名称php fpm-v/data/docker/php fpm/configs/:/usr/local/etc/php fpm。d-v/
PHP-FPM 是一个 PHP FastCGI 进程管理器。 FastCGI 是一个可伸缩的,高速地在web server和脚本语言间交互的接口。FastCGI的主要优点是把动态语言和web server分离开来。这种技术允许把web server和动态语言运行在不同的主机上,以大规模扩展和改进安全性而不损失生产效率。 PHP-FPM 可以和任何支持远端 FastCGI 的 web server 工作。