我使用ubuntu wizzy作为本地服务器,然后在那里设置域
域.svr
api.domain.svr文件
adm.domain.svr公司
这就是问题所在。我为它们创建了完全相同的配置,但为什么只有adm.domain.svr不工作?当我转到http://adm.domain.svr/site/dashboard/时它总是响应404,但是当我尝试http://api.domain.svr/site/dashboard/时它是可以的。
这是我的配置

 <VirtualHost *:80>
      ServerAdmin [email protected]
      ServerName  domain.svr

      DocumentRoot /home/shaf/web/domain.dev/frontend/web
      <Directory />
           Options FollowSymLinks
           AllowOverride all
      </Directory>
      <Directory /home/shaf/web/domain.dev/frontend/web>
           Require all granted
           Options -Indexes +FollowSymLinks +MultiViews
           AllowOverride all
           Order allow,deny
           allow from all
      </Directory>

      ErrorLog /home/shaf/log/domain-error.log
      LogLevel warn

      CustomLog /home/shaf/log/domain-access.log combined
 </VirtualHost>
 <VirtualHost *:80>
      ServerAdmin [email protected]
      ServerName  adm.domain.svr

      DocumentRoot /home/shaf/web/domain.dev/backend/web
      <Directory /home/shaf/web/domain.dev/backend/web>
           Require all granted
           Options -Indexes +FollowSymLinks +MultiViews
           AllowOverride all
           Order allow,deny
           allow from all
      </Directory>

      ErrorLog /home/shaf/log/domain-adm-error.log
      LogLevel warn

      CustomLog /home/shaf/log/domain-adm-access.log combined
 </VirtualHost>
 <VirtualHost *:80>
      ServerAdmin [email protected]
      ServerName  api.domain.svr

      DocumentRoot /home/shaf/web/domain.dev/api/web
      <Directory />
           Options FollowSymLinks
           AllowOverride all
      </Directory>
      <Directory /home/shaf/web/domain.dev/api/web>
           Require all granted
           Options -Indexes +FollowSymLinks +MultiViews
           AllowOverride all
           Order allow,deny
           allow from all
      </Directory>

      ErrorLog /home/shaf/log/domain-api-error.log
      LogLevel warn

      CustomLog /home/shaf/log/domain-api-access.log combined
 </VirtualHost>

这是我的.htaccess,我把它放在每个域的web文件夹上
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

请给我一些建议,我真的不知道。

最佳答案

服务器名domain.svr错误。apache无法路由它。尝试将其重命名为adm.domain.svr

10-07 13:59