You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu升级PHP 8.2后虚拟主机无法正常工作求助

问题排查记录与求助

已多次检查所有配置,一切看似正常,升级前所有功能(包括SSL/TLS访问)均正常,重启Apache无报错,但域名访问存在异常(IP访问正常)。以下是排查细节:

1. Apache配置语法检查

执行命令:

sudo apache2ctl configtest

输出:

Syntax OK 

2. 虚拟主机配置列表

执行命令:

apache2ctl -S

输出:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server XX.leaseweb.net (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost XX.leaseweb.net (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost XX0.ch (/etc/apache2/sites-enabled/XX0.ch.conf:1)
                 alias www.XX0.ch
         port 80 namevhost XXloud.com (/etc/apache2/sites-enabled/XXloud.com.conf:1)
                 alias www.XXloud.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default 
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

3. 文件权限设置

所有文件已设置chown www-data:www-data权限,执行的权限命令:

sudo chmod -R 755 /var/www

4. XX0.ch.conf虚拟主机配置

通过sudo nano /etc/apache2/sites-available/XX0.ch.conf编辑的配置内容:

HTTP(80端口)配置

<VirtualHost *:80>
    ServerAdmin webmaster@XXloud.com
    ServerName XXloud.com
    ServerAlias www.XXloud.com
    DocumentRoot /var/www/XX0.ch
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =XXloud.com [OR]
RewriteCond %{SERVER_NAME} =www.XXloud.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

HTTPS(443端口)配置

<IfModule mod_ssl.c>
<VirtualHost *:443>
    Protocols h2 h2c http/1.1
    ServerAdmin webmaster@XXloud.com
    ServerName XXloud.com
    ServerAlias www.XXloud.com
    DocumentRoot /var/www/XX0.ch
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/XX0.ch/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/XX0.ch/privkey.pem
</VirtualHost>
</IfModule>

5. IP访问验证

通过IP地址访问包含phpinfo();的页面正常:

//http://XXX.XXX.62.175/index.php

phpinfo();
=> 正常显示PHP版本 8.2.6

求解决办法。

内容的提问来源于stack exchange,提问作者Pippo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 20:05:17