Isso é resolvido fazendo alterações no arquivo /etc/apache2/apache2.conf
.
Fiz alterações em line no:166
. Formulário None
a All
.
Eu configurei meu projeto em localhost e em servidor de temporariedade.
Mas agora eu quero mover meu projeto em ubuntu
server.
eu tentei, mas quando eu tento localizar o meu projeto está me dando The requested URL <PROJECT_NAME>/admin/site/login was not found on this server.
Aqui está o meu arquivo main.php
:
<?php
use \yii\web\Request;
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/params-local.php')
);
include(__DIR__ . '/constants.php');
include(__DIR__ . '/print_arr_helper.php');
$siteUrl = 'http://**IPADDRESS**/<PROJECT_NAME>/';
return [
'id' => 'app-backend',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'modules' => [],
'as beforeRequest' => [
'class' => 'yii\filters\AccessControl',
'rules' => [
[
'actions' => ['login', 'error'],
'allow' => true,
],
[
'allow' => true,
'roles' => ['@'],
],
],
],
'components' => [
'request'=>[
'class' => 'common\components\Request',
'web'=> '/backend/web',
'adminUrl' => '/admin',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => []
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => false,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'mongodb' => [
'class' => '\yii\mongodb\Connection',
'dsn' => 'mongodb://localhost:27017/<DB_NAME>',
],
'errorHandler' => [
'errorAction' => 'site/error',
],
],
'params' => $params,
];
?>
Aqui está o meu arquivo .htaacess
:
Options +FollowSymlinks
RewriteEngine On
# deal with admin first
RewriteCond %{REQUEST_URI} ^/<PROJRCT_NAME>/(admin)
RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
RewriteCond %{REQUEST_URI} !^/<PROJRCT_NAME>/backend/web/(assets|css)/
RewriteCond %{REQUEST_URI} ^/<PROJRCT_NAME>/(admin)
RewriteRule ^.*$ backend/web/index.php [L]
RewriteCond %{REQUEST_URI} ^/<PROJRCT_NAME>/(assets|css)
RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
RewriteCond %{REQUEST_URI} !^/<PROJRCT_NAME>/(frontend|backend|ws)/web/(assets|css)/
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php
Em backend/
forlders .htaccess
, se eu escrever <IPADDRESS>/backend/
em URL
, então, ele será redirecionado para http://<IPADDRESS>/<PROJECT_NAME>/admin/site/login
.
Alguém pode ajudar?
Isso é resolvido fazendo alterações no arquivo /etc/apache2/apache2.conf
.
Fiz alterações em line no:166
. Formulário None
a All
.