How to set Entry point for docker and yii2 advance template

24 views Asked by At

I have some doubts about how to set entry point for yii2 advance template. I'll use docker and for example:

http://localhost:8000/yii-app/backend/web/index.php works fine (i've enabled pretty urls and works fine). Now, as Documentation says, i try to set backend.test instead of http://localhost:8000/yii-app/backend/web/index.php

I've modified my apache.conf inside my docker adding the following code:

<VirtualHost *:80>
        ServerName frontend.test
        DocumentRoot "/yii-app/frontend/web/"
           
        <Directory "/yii-app/frontend/web/">
            # use mod_rewrite for pretty URL support
            RewriteEngine on
            # If a directory or a file exists, use the request directly
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            # Otherwise forward the request to index.php
            RewriteRule . index.php

            # use index.php as index file
            DirectoryIndex index.php

            # ...other settings...
            # Apache 2.4
            Require all granted
               
            ## Apache 2.2
            # Order allow,deny
            # Allow from all
        </Directory>
    </VirtualHost>
       
    <VirtualHost *:80>
        ServerName backend.test
        DocumentRoot "/yii-app/backend/web/"
           
        <Directory "/yii-app/backend/web/">
            # use mod_rewrite for pretty URL support
            RewriteEngine on
            # If a directory or a file exists, use the request directly
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            # Otherwise forward the request to index.php
            RewriteRule . index.php

            # use index.php as index file
            DirectoryIndex index.php

            # ...other settings...
            # Apache 2.4
            Require all granted
               
            ## Apache 2.2
            # Order allow,deny
            # Allow from all
        </Directory>
    </VirtualHost>

Inside my backend/web folder i've add

RewriteEngine on
# 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

And in my host file i've add

127.0.0.1   frontend.test
127.0.0.1   backend.test

But when i try to access backend.test doesn't work

0

There are 0 answers