Git Product home page Git Product logo

Comments (13)

mickgeek avatar mickgeek commented on May 27, 2024

What exactly doesn't work? Give more information and show the directory hierarchy.

from yii2-advanced-one-domain-config.

avinashz avatar avinashz commented on May 27, 2024

Directory structure is set as below image, highlighted part is my document root, You can see two more directory under doc root and then Yii2 setup. I have made all changes which is mentioned in you repository.

image

Url : http://192.168.0.2:36/project/yii-advance/ showing me 404 see below image

image

Url : http://192.168.0.2:36/project/yii-advance/admin showing me 404 see below image

image

Let me know if any further details required

from yii2-advanced-one-domain-config.

avinashz avatar avinashz commented on May 27, 2024

If I add below line in root htaccess file then it is showing 500 internal server error.

RewtiteBase /project/yii-advance/

from yii2-advanced-one-domain-config.

mickgeek avatar mickgeek commented on May 27, 2024

The RewtiteBase directive doesn't exist. What you have in the log file of the web server when there is 404?

from yii2-advanced-one-domain-config.

avinashz avatar avinashz commented on May 27, 2024

sorry it was typo. RewriteBase /project/yii-advance/ also gives me 404 and nothing being logged in my error log file. anything I need to do to enable logging?

Here is my virtual host for your information:

# Yii2 Sub Dir
Listen *:36
<Directory "G:\study\yii-subdir">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
<VirtualHost *:36>
    ServerAdmin [email protected]
    DirectoryIndex index.php index.html
    DocumentRoot "G:\study\yii-subdir"
    ServerName dummy-host2.example.com
    ErrorLog "logs/subdir-error.log"
    #CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

from yii2-advanced-one-domain-config.

mickgeek avatar mickgeek commented on May 27, 2024

Try the following configuration by changing the parameters on your own.

Virtual host:

<VirtualHost *:80>
    ServerName yii2.loc

    DocumentRoot "/media/sf_www/deb7apache/docs/yii2.loc"
    <Directory "/">
        DirectoryIndex index.html index.php
        AllowOverride All
    </Directory>
</VirtualHost>

yii2.loc/demo/advanced/.htaccess:

Options FollowSymLinks
AddDefaultCharset utf-8

<IfModule mod_rewrite.c>
    RewriteEngine On

    # the main rewrite rule for the frontend application
    RewriteCond %{REQUEST_URI} !^/demo/advanced/(frontend/web|backend/web|admin)
    RewriteRule ^(.*) /demo/advanced/frontend/web/$1 [L]

    # redirect to the page without a trailing slash (uncomment if necessary)
    #RewriteCond %{REQUEST_URI} ^/demo/advanced/admin/$
    #RewriteRule ^(admin)/ /demo/advanced/$1 [L,R=301]
    # the main rewrite rule for the backend application
    RewriteCond %{REQUEST_URI} ^/demo/advanced/admin
    RewriteRule ^admin(.*) /demo/advanced/backend/web/$1 [L]

    # if a directory or a file of the frontend application exists, use the request directly
    RewriteCond %{REQUEST_URI} ^/demo/advanced/frontend/web
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # otherwise forward the request to index.php
    RewriteRule . /demo/advanced/frontend/web/index.php [L]

    # if a directory or a file of the backend application exists, use the request directly
    RewriteCond %{REQUEST_URI} ^/demo/advanced/backend/web
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # otherwise forward the request to index.php
    RewriteRule . /demo/advanced/backend/web/index.php [L]

    RewriteCond %{REQUEST_URI} \.(htaccess|htpasswd|svn|git)
    RewriteRule \.(htaccess|htpasswd|svn|git) - [F]
</IfModule>

In the frontend configuration file, change the value of the baseUrl property to /demo/advanced, in the backend - to /demo/advanced/admin. And everything else is same as in the manual.

from yii2-advanced-one-domain-config.

avinashz avatar avinashz commented on May 27, 2024

Does above changes works at your end?

I am getting below mentioned errors:

( ! ) Warning: require(G:\study\yii-subdir\project\yii-advance\frontend\web/../../common/config/main-local.php): failed to open stream: No such file or directory in G:\study\yii-subdir\project\yii-advance\frontend\web\index.php on line 12

( ! ) Fatal error: require(): Failed opening required 'G:\study\yii-subdir\project\yii-advance\frontend\web/../../common/config/main-local.php' (include_path='.;C:\php\pear') in G:\study\yii-subdir\project\yii-advance\frontend\web\index.php on line 12

Image for reference:

image

from yii2-advanced-one-domain-config.

mickgeek avatar mickgeek commented on May 27, 2024

Yes, on Debian works fine. Make sure that the application was initialized (details).

from yii2-advanced-one-domain-config.

avinashz avatar avinashz commented on May 27, 2024

I have installed using composer so it must be initialized automatically?

from yii2-advanced-one-domain-config.

avinashz avatar avinashz commented on May 27, 2024

@mickgeek not sure but I have tried init for my app and it works. Thanks for all the help.

Just thought: Can we have something which works regardless of structure?

from yii2-advanced-one-domain-config.

mickgeek avatar mickgeek commented on May 27, 2024

Installation via Composer (or from the archive file) only copies the data repository. Then you should to prepare the application to run. See the link above.

from yii2-advanced-one-domain-config.

mickgeek avatar mickgeek commented on May 27, 2024

I am glad to help.

Create a configuration that would work regardless of a structure is hardly possible. Sysadmins must deal with fine-tuning the server.

from yii2-advanced-one-domain-config.

dbd5 avatar dbd5 commented on May 27, 2024

@avinashz,

If at all possible, I suggest you make your installation match the exact scenario that this project has been configured for so you can at least get it working to start with.
Thereafter you can start tweaking one setting at a time followed by testing.
In other words NOT install under sub-directory of documentroot.
Don't be in a hurry to give up on this nice piece of work by @mickgeek

Adam

from yii2-advanced-one-domain-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.