Laravel - 默认虚拟主机不能工作(以前工作但不是现在)

时间:2016-09-07 09:48:34

标签: apache laravel laravel-5 virtualhost

嗨我安装了laravel并且工作正常

我的httpd-vhosts.conf是

<VirtualHost laravel.dev:80>
    DocumentRoot "C:\xampp\htdocs\laravel\public"
    ServerAdmin laravel.dev
    <Directory "C:\xampp\htdocs\laravel">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost taskmanagement.dev:80>
    DocumentRoot "C:\xampp\htdocs\taskmanagement\public"
    ServerAdmin taskmanagement.dev
    <Directory "C:\xampp\htdocs\taskmanagement">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost wp.dev:80>
    DocumentRoot "C:\xampp\htdocs\wordpress"
    ServerAdmin wp.dev
    <Directory "C:\xampp\htdocs\wordpress">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted 
    </Directory>
</VirtualHost>

我的主机文件是

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1    laravel.dev
127.0.0.1    taskmanagement.dev
127.0.0.1    wp.dev
127.0.0.1    localhost

我在C:\ xampp \ htdocs \ site1 \ index.php下有一个网页或网站 当我尝试打开我的网站时(http://localhost/site1/) 在浏览器中显示

  

RouteCollection.php第161行中的NotFoundHttpException:错误

但我以下的所有虚拟主机网站都运行良好

  

http://localhost/laravel/public   
  http://localhost/taskmanagement/public   
  http://localhost/wordpress

我的问题只是默认网站php,html(没有虚拟主机) - xampp

在我的C:\ xampp \ htdocs中有以下

C:\xampp\htdocs\arunsite\public --> laravel project -working
C:\xampp\htdocs\college\public --> laravel project -working
C:\xampp\htdocs\laravel\public --> laravel project -working
C:\xampp\htdocs\lartest\public --> laravel project -working
C:\xampp\htdocs\taskmanagement\public --> noframework- html site -notworking
C:\xampp\htdocs\test\site1\index.php -->  noframework- html site -notworking
C:\xampp\htdocs\test\site2\index.php -->  noframework- html site -notworking
C:\xampp\htdocs\test\site3\index.php -->  noframework- html site -notworking
.
.
.
C:\xampp\htdocs\test\site50\index.php -->  noframework- html site -notworking

2 个答案:

答案 0 :(得分:0)

当您激活v-hosts配置时,默认localhost通常会被替换。

所以只需在v-hosts

中添加所述条目即可
<VirtualHost localhost:80>
DocumentRoot "C:\xampp\htdocs\"
ServerAdmin localhost
<Directory "C:\xampp\htdocs\">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

之后重启apache

答案 1 :(得分:0)

根据@huzaib的建议进行输入并重启apache。您还可以检查xampp日志以获取具体的详细信息,如果不能正常工作则特别分享该日志行。