[英]Laradock - Localhost refused to connect on Windows 10 using Nginx
I have setup a laradock app on my local machine. 我在本地机器上安装了一个laradock应用程序。 I have followed the instructions as provided: http://laradock.io/ 我按照提供的说明操作: http : //laradock.io/
In addition to that as I am on Windows 10, and using Docker toolbox, I have shared my folder with the laradock's workspace. 除了我在Windows 10上,并使用Docker工具箱,我已经与laradock的工作区共享我的文件夹。 That's working fine as I can see my app's folders inside the workspace when I run the following command 这工作正常,因为当我运行以下命令时,我可以在工作区内看到我的应用程序文件夹
docker-compose exec workspace bash
I have also added a host entry inside my hosts file on windows. 我还在Windows上的hosts文件中添加了一个主机条目。 127.0.0.1 localhost
But nothing works. 但没有任何作用。 I get a response 'localhost refused to connect'. 我收到回复'localhost拒绝连接'。 Even css files inside public folder are not accessible 甚至公共文件夹中的css文件也无法访问
You should checkout the nginx/sites
folder inside your laradock
folder. 你应该检查你的laradock
文件夹中的nginx/sites
文件夹。 Check the root path inside default.conf
- root /var/www/public;
检查default.conf
的根路径 - root /var/www/public;
should correspond to where your project /public
folder actually is inside workspace
. 应该对应于项目/public
文件夹实际位于workspace
区内的位置。
I personally use laradock for many projects and create multiple .conf
files that correspond to my sites name like myproject1.test
- myproject1.conf
and my file structure is like that: 我个人在许多项目中使用laradock并创建多个.conf
文件,这些文件对应于我的网站名称,如myproject1.test
- myproject1.conf
,我的文件结构是这样的:
/laradock
/myproject1
/myproject2
hosts file: 主机文件:
127.0.0.1 myproject1.test
127.0.0.1 myproject2.test
myproject1.conf
inside nginx/sites
: nginx/sites
myproject1.conf
:
...
server_name myproject1.test;
root /var/www/myproject1/public;
...
Hope that helps 希望有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.