【发布时间】:2019-12-28 21:40:43
【问题描述】:
我尝试在 https 下设置 PHP Fat-free framework(f3) 工作,但失败了。我在 http 下使用了 f3 路由,它在 Debian 10 + apache2 + PHP 7.3 环境中运行良好。最近我在 apache 上添加了一个自签名 ssl,然后所有 f3 路由都变成了 '404 not found on this server' 除了根路由($f3->route('GET /',...);)。
f3 路由的 apache 重写引擎在 http 协议下正常唤醒。改写规则来自f3官方建议(https://fatfreeframework.com/3.6/routing-engine#SampleApacheConfiguration),设置在站点文档根目录2级子目录下的.htaccess文件中。我在 .htaccess 中的“RewriteEngine On”之后添加了“RewriteBase /foo/bar/”。
这些示例 f3 路由代码位于 index.php 中。它们都在http协议下工作,只有'GET /'可以在https连接下工作。
- http 工作,https 也工作。打印一个类似“hello world”的模板。
$f3->route('GET /', function($f3){
$f3->set('name', 'f3-routing');
$template = \Template::instance();
echo $template->render('std2.html');
});
- http 工作,打印'test1'; https 不起作用,在此服务器上找不到显示 URL。
$f3->route('GET /test1', function(){echo "test1";});
- http工作,打印一个'hello world'样模板; https 不起作用,在此服务器上找不到显示 URL。
$f3->route(array('GET /@conf_id/@room_id'),
function($f3, $params) {
$template = \Template::instance();
echo $template->render('disp_ppt.html');
}
);
【问题讨论】:
-
SSL 网站通常在 apache 中有不同的配置文件。https.conf ..将其与您的 http.conf 进行比较,并进行所需的更改以使其运行.. 它可能类似于“此主机的 https apache 配置中不存在的 AllowOverwrite all"。
标签: php https routes fat-free-framework