laravel-opcache: Laradock - Failed to connect to localhost port 80: Connection refused

I’m using laradock and trying to run php artisan opcache:clear in the workspace container where my projects are located. Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

For anyone who uses Laradock for local development, I fixed this problem by changing /etc/hosts of workspace container.

First, use docker ps and find Nginx container ID. Then run docker inspect NGINX_CONTAINER_ID and find "IPAddress" in output.

 "Networks": {
  "laradock_backend": {
    ...
    "Gateway": "172.20.0.1",
    "IPAddress": "172.20.0.10", // THIS
    ...
  }
 }

Enter the workspace container.

docker exec -it WORKSPACE_CONTAINER_ID /bin/bash

Edit /etc/hosts: vi /etc/hosts and add your Nginx IP and your website virtual host like this:

x.x.x.x     virtualhost.local

Which in my case was:

172.20.0.10     site.local

If you have opcache enabled already, then you need to restart nginx. Else try to run composer dump-autoload -o, php artisan clear-compiled, php artisan cache:clear and php artisan optimize