Just installed Lumen and got NotFoundHttpException

前端 未结 4 1132
梦如初夏
梦如初夏 2021-01-04 03:54

I\'m searching for a solution ... it\'s getting so frustrating. After a fresh installation of Lumen by Laravel, I simply can\'t access the \"/\" route. When I try to, it thr

4条回答
  •  耶瑟儿~
    2021-01-04 04:08

    I had the same problem today.

    I was accessing it using the url http://localhost/lumen.api/public/ and I think that was the cause of the error.

    To get around it, this is what I did:

    First I configured a new VirtualHost entry on Xampp, located in "C:\xampp\apache\conf\extra\httpd-vhosts.conf" in my case:

    
        DocumentRoot "C:/xampp/htdocs/lumen.api/public"
        ServerName lumen.api
        ServerAlias www.lumen.api
        ErrorLog "logs/lumen.api-error.log"
        CustomLog "logs/lumen.api-access.log" common
        
            AllowOverride All
            Require all Granted
        
    
    

    and restarted Apache on Xampp.

    Then I edited my hosts file (c:\windows\system32\drivers\etc\hosts) to map a new address to my localhost.

    # localhost name resolution is handled within DNS itself.
    #   127.0.0.1       localhost
    #   ::1             localhost   
        127.0.0.1       lumen.api
    

    I tried again using the new URL http://lumen.api and the error was gone.

提交回复
热议问题