Open budipratama opened 3 years ago
I had same here.
[[A2021-03-07 00:14:27 [10.69.64.29][-][-][error][yii\web\HttpException:404] yii\base\InvalidRouteException: Unable to resolve the request "index.php". in PATHvendor/yiisoft/yii2/base/Module.php:543
Can you submit a minimal project at github and share it to me? I'll check your code
Can you submit a minimal project at github and share it to me? I'll check your code
sure! https://github.com/FogoQueima/advancedyii2-swoole/tree/master
server { listen 65450 default; root /usr/local/www/testeswoole/advanced/frontend/web; index index.php index.html; client_max_body_size 500m; charset utf-8; location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9500;
}
}
My nginx.conf. maybe the problem is here
Use the full frontend config
My frontend/config/swoole.php
<?php
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/../../common/config/main.php',
require __DIR__ . '/../../common/config/main-local.php',
require __DIR__ . '/main.php',
require __DIR__ . '/main-local.php'
);
$config['components']['response']['class'] = swoole\foundation\web\Response::class;
$config['components']['request']['class'] = swoole\foundation\web\Request::class;
$config['components']['errorHandler']['class'] = swoole\foundation\web\ErrorHandler::class;
return $config;
I have invalid route when use template advanced with use controllerNamespace like bellow :
HTTP/1.1 404 Not Found Content-Type: application/json; charset=UTF-8 Server: swoole-http-server Connection: keep-alive Date: Tue, 16 Feb 2021 19:41:13 GMT Content-Length: 246
{"name":"Not Found","message":"Page not found.","code":0,"status":404,"type":"yii\web\NotFoundHttpException","previous":{"name":"Invalid Route","message":"Unable to resolve the request \"\".","code":0,"type":"yii\base\InvalidRouteException"}}