简体   繁体   English

本地设置上的 Laravel NotFoundHTTPException

[英]Laravel NotFoundHTTPException on local setup

I have inherited a site built with Laravel and Cartalyst from another developer that is working correctly on the production server however on my local installation I get a NotFoundHTTPException on the homepage and no other pages work.我从另一个开发人员那里继承了一个使用 Laravel 和 Cartalyst 构建的站点,该站点在生产服务器上正常工作,但是在我的本地安装中,我在主页上收到了 NotFoundHTTPException 并且没有其他页面工作。 Local setup is laptop running Ubuntu and using Apache.本地设置是运行 Ubuntu 并使用 Apache 的笔记本电脑。

Have tried searching the forums to no avail.曾尝试搜索论坛无济于事。 The site works totally correctly on the production server so it feels like it must be a configuration issue on my end rather than an actual coding issue.该站点在生产服务器上完全正常工作,因此感觉它一定是我的配置问题,而不是实际的编码问题。

When one runs php artisan route:list all routes are listed.当运行 php artisan route:list 时,会列出所有路由。 Have also tried clearing the routing cache.也尝试清除路由缓存。

Any help or advice would really be appreciated.任何帮助或建议将不胜感激。 Relevant bits of files below.下面的相关文件。

.env file (relevant portion) .env 文件(相关部分)


    APP_KEY=xxxxxxxxxxxx
    APP_ENV=local
    APP_DEBUG=true
    APP_LOG_LEVEL=debug
    APP_URL=https://local.voicemag.uk

.htaccess .htaccess


    <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
     Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    </IfModule>

Apache configuration阿帕奇配置


    <VirtualHost *:443> ServerName local.voicemag.uk
    ServerAlias local.voicemag.uk

    ServerAdmin webmaster@localhost
    DocumentRoot /home/chris/Documents/Webdev/fresh/voicemagv3/public_html

    SSLEngine on
    SSLCertificateFile "/home/chris/Documents/Webdev/ssl/server.crt"
    SSLCertificateKeyFile "/home/chris/Documents/Webdev/ssl/server.key"

    <Directory /home/chris/Documents/Webdev/fresh/voicemagv3/public_html>
      Require all granted
      Allowoverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

Let me know if you need anything further.如果您还需要什么,请告诉我。

NotFOundHttpException just comes because your web not find any route related to that name try to either access it by making virtual host or by NotFoundHttpException 只是因为您的网络找不到与该名称相关的任何路由尝试通过创建虚拟主机或通过

php artisan serve 

which host your site on http://localhost:8000http://localhost:8000上托管您的网站

The solution was to run php artisan extension:autoload解决方案是运行php artisan extension:autoload

Many thanks everyone for their help非常感谢大家的帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM