O
O
Oversec2016-09-22 23:23:35
Yii
Oversec, 2016-09-22 23:23:35

How to properly upload a Yii2 project to the server?

I'm trying to upload a Yii2 project from a github repository. I set everything up, git clone did everything. But the application does not start on the server. When trying to enter sitename.ru/web/, it redirects to /web/site/login and gives an error:
Not Found
The requested URL sitename.ru/web/index.php was not found on this server.
Apache/2.2.22 (@[email protected]) Server at sutename.ru Port 80
Although the local application works without problems. Maybe there is some instruction on how to deploy the application correctly?
in the web/.htaccess folder
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                [
                    'pattern' => '', //Шаблон для главной
                    'route' => 'site/index',
                ],
                [
                    'pattern' => '<controller>/<action>/<id:/d+>', //Шаблон для контроллеров с id
                    'route' => '<controller>/<action>',
                ],
                [
                    'pattern' => '<controller>/<action>', //Шаблон для контроллеров
                    'route' => '<controller>/<action>',
                ],
                [
                    'pattern' => '<module>/<controller>/<action>', //Шаблон для модулей
                    'route' => '<module>/<controller>/<action>',
                ],
                [
                    'pattern' => '<module>/<controller>/<action>/<id:/d+>', //Шаблон для модулей с id
                    'route' => '<module>/<controller>/<action>',
                ],
            ]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Ne-Lexa, 2016-11-02
@Oversec

It looks like you configured the web server incorrectly.
The /web/ folder must be DOCUMENT_ROOT, use it when configuring the web server.
You will have to go to sitename.ru.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question