OpenSUSE v15.2, Apache를 사용하세요.
PHP-FPM을 설치하려면 zypper를 사용하세요. 웹사이트의 지침을 따르십시오. https://en.opensuse.org/SDB:Apache_FastCGI_and_PHP-FPM_configuration
Apache와 PHP-FPM을 다시 시작했습니다. 그런데 웹사이트가 브라우저에 로딩되지 않습니다.
HTTP 오류 502가 발생합니다.
lynx http://10.20.30.40/info.php
결과Alert!: HTTP/1.0 502 cannotconnect
또한 다음 오류가 발생합니다.
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는 실행되지 않지만, info.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
실행 중임을 표시하고 다시 시작하는 것으로 표시하지만 그게 전부입니다.
아파치 오류 로그:
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는 생성되지 않습니다.
아파치 정보:
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.conf
[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
어떤 아이디어가 문제가 될 수 있습니까?