2017-10-07 1 views
0

저는 실제로 백엔드에 어떻게 접근 할 수 있습니까? 내가 고급 템플릿을 설치 한 방법은 공식 사이트에서 보여주는 방법과 같습니다 : http://www.yiiframework.com/download/. 모든 것이 단계적으로 이루어집니다. frontend.dev (내 경우에는 eshop)를 시도 할 때 frontend 부분으로 리디렉션되지만 backend.dev (내 경우에는 eshop/admin)를 시도 할 때 frontend로 리디렉션됩니다. 이 내 호스트 파일입니다Yii2가 백엔드 파트에 도달 할 수 없습니다.

# Copyright (c) 1993-2009 Microsoft Corp. 
# 
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 
# 
# This file contains the mappings of IP addresses to host names. Each 
# entry should be kept on an individual line. The IP address should 
# be placed in the first column followed by the corresponding host name. 
# The IP address and the host name should be separated by at least one 
# space. 
# 
# Additionally, comments (such as these) may be inserted on individual 
# lines or following the machine name denoted by a '#' symbol. 
# 
# For example: 
# 
#  102.54.94.97  rhino.acme.com   # source server 
#  38.25.63.10  x.acme.com    # x client host 

# localhost name resolution is handled within DNS itself. 
# 127.0.0.1  localhost 
# ::1    localhost 
# 127.0.0.1  modules 
127.0.0.1  eshop 
127.0.0.1  eshop/admin 

0.0.0.1 mssplus.mcafee.com 

그리고 vhost.conf :

<VirtualHost *:80> 
    ServerName eshop 
    DocumentRoot "C:/xampp/htdocs/eshop/frontend/web/" 

    <Directory "C:/xampp/htdocs/eshop/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 eshop/admin 
    DocumentRoot "C:/xampp/htdocs/eshop/backend/web/" 

    <Directory "C:/xampp/htdocs/eshop/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> 

내 실수는? 미리 감사드립니다!

+0

고급 템플릿 [Composer를 사용하여 설치] (https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/start-installation.md). – vishuB

+0

Propably'eshop/admin'은'eshop' 프론트 엔드로 인식되고'admin'은 컨트롤러로 인식됩니다. vhost를'admin.eshop' 또는 무엇인가로 설정하십시오. – Yupik

+0

예. 구분 기호가 점 (.)이지만 올바른 방법으로 슬래시 (/)를 만들면 어떻게됩니까? '.htaccess' 파일에 몇 가지 변경 사항을 추가해야합니까? –

답변

1

RFC 952에 정의 된대로 호스트 이름에 슬래시 (/)를 사용하는 것은 올바르지 않습니다. 그러므로 URL "http://eshop/admin"에서 서버 이름은 "eshop"이고 아파치는 첫 번째 가상 서버 설정을 사용하고 있습니다. 요약하면 아이디어는 작동하지 않습니다. 서버 이름으로 eshop-admin을 사용해야합니다.

관련 문제