Install httpd

ref:https://cwiki.apache.org/confluence/display/HTTPD/PHP-FPM

ref:https://dev.to/xsavitar/issue-starting-up-apache-after-upgrading-to-php-8-on-macos-2274

ref:https://blog.csdn.net/qq_44009311/article/details/105496897

ref:https://blog.csdn.net/weixin_33736649/article/details/88198840

system: centos 8

php: php 8.0.22

配置httpd

sudo vi /etc/httpd/conf/httpd.ini

添加

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

开机启动

systemctl enable httpd

启动httpd

systemctl start httpd

查看日志

/var/log/httpd/error_log

/var/log/httpd/access_log

转发到php上,php版本市8.0.22,使用php-fpm,所以httpd.conf中不需要配置AddType php之类的,可以注释掉。

关注httpd.conf底部IncludeOptional conf.d/*.conf,在httpd的conf.d(/etc/httpd/conf.d/)新建

vi /etc/httpd/conf.d/httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName vrntf.com
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1
<Directory "/var/www/html">
    Options none
    AllowOverride none
    Require all granted
</Directory>

ErrorLog "/var/log/httpd/wp-error.log"
CustomLog "/var/log/httpd/wp-access.log" combined
</VirtualHost>

注意本实例中DocumentRoot是配置为和httpd的一致,根据需要进行调整,在安装php时设置的user,要保证php有权限访问得到。

fcgi后面的路径也必须能访问得到。