尝试修复Laravel安装中文件路径的损坏 [英] Trying to fix a broken a path for files in a Laravel Installation

查看:111
本文介绍了尝试修复Laravel安装中文件路径的损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我正在使用MAMP(mac)运行Laravel安装,该安装是通过Bit Bucket使用git克隆的.该站点已加载,但所有CSS和JS文件均已损坏.如果您查看源代码,则可以看到标记和如下图所示的URL.

OK, so I'm running a Laravel installation using MAMP (mac) which was cloned using git via Bit Bucket. The site loads but all the CSS and JS files are broken. If you view source you can see the markup and the URL's like the image below.

但是,如果您单击任意一个URL,那么您会得到一个Chrome浏览器错误,提示:无法访问此站点,连接已重置,等等."

However, if you click on any of the URL's then you get a chrome browser error saying: This site can't be reached, the connection was reset etc".

我的MAMP安装URL为 http://localhost:8000/login ,这是有趣的事情,如果我从以下位置更改URL的完整路径:

My MAMP installation URL is http://localhost:8000/login and here's the interesting thing, if I change the full path of the URL from:

不良 : http://nestdb.local/css/chosen.min.css (即未加载),位于Laravel安装目录内

BAD: http://nestdb.local/css/chosen.min.css (i.e. doesn't load) which is within the Laravel installation

但是如果我更改此路径,那么它将加载:

but if I change the path to this then it does load:

GOOD : http://localhost:8000/css/chosen.min.css

很明显,这里存在路径问题,但是我不确定如何解决.这是我的.env文件:

So clearly there is a path problem, but I am not sure how to solve it. This is my .env file:

APP_ENV=localwg
APP_KEY=base64xXXXXXXXXX/hSpKzqI8= (remove this for security)
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://nestdb.local
APP_TIMEZONE = Asia/Hong_Kong

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nestlaravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

MY_HOST=nestdb.local
PRODUCTION_SERVER=1
HOST_ROOT=http://nestdb.local/

我的etc文件是这样的:

And my etc file is like this:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1 localhost
127.0.0.1 nest.test
127.0.0.1 nestdb.test
127.0.0.1 nestdb.local
127.0.0.1 test.test

我将.env文件中的APP_URL更改为APP_URL=http://nestdb.local:8000,但也没有乐趣.

I changed the APP_URL in the .env file to APP_URL=http://nestdb.local:8000 but no joy either.

请问有人为什么要调整此安装才能使它正常工作吗?

Does anyone why or what I should be adjusting to get this installation to work?

这还可能是MAMP虚拟主机问题吗?

Could it also be a MAMP Virtual Hosts Issue?

推荐答案

"nestdb.local"指向端口80上的本地主机,而MAMP在端口8000上运行. ://nestdb.local:8000/css/chosen.min.css"rel =" nofollow noreferrer> http://nestdb.local:8000/css/chosen.min.css

"nestdb.local" points to your localhost on port 80 and your MAMP is running on port 8000. The following should work fine: http://nestdb.local:8000/css/chosen.min.css

因此,您必须修改laravel .env并将端口添加到APP_URL:

So you have to modify you laravel .env and add the port to the APP_URL:

APP_URL=http://nestdb.local:8000

这篇关于尝试修复Laravel安装中文件路径的损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆