我有两个域。假设reports.test.com
和report.test.com
指向一个Laravel 5.0应用程序。有时在我的日志文件中,它显示NotFoundHttpException in RouteCollection.php line 145:
错误。 为什么我的应用程序记录NotFoundHttpException?
这些是我的日志文件的位置
http://reports.test.com/storage/logs/laravel-2018-08-13.log
http://report.test.com/storage/logs/laravel-2018-08-13.log
答案 0 :(得分:0)
正确解决该问题的一种方法是将一个域用作主域,将第二个域重定向至主域。
reports
是主要的。A reports.test.com 123.123.123.123 # IP is just an example
A report.test.com 123.123.123.123 # IP is just an example
例如,nginx服务器块将如下所示:
server {
listen 80;
server_name report.test.com;
# ...
rewrite ^ http://reports.test.com$request_uri? permanent;
}
# ... (your main app serverblock)
使用特权用户编辑服务器块# service nginx reload
后,重新启动nginx。
APP_URL="http://reports.test.com"
如果您使用配置缓存,请与部署用户一起更新缓存:php artisan config:cache
。
请注意,如果您愿意使用HTTPS,则可能需要根据需要进行编辑。