Laravel Homestead Redis Port Forwarding

Remove ports settings from your Homestead.yaml you won't need it.

Now by default redis in homestead vm is listening on its normal port, 6379.

You can ssh into your vm and check it:

vagrant@homestead:~$ ps -aux | grep redis
redis      996  0.1  0.4  35232  8752 ?        Ssl  01:53   0:00 /usr/bin/redis-server *:6379

To connect to the vm's redis instance from your local machine you need to use an IP address that is specified in your Homestead.yaml. By default it is 192.168.10.10:

redis-cli -h 192.168.10.10

If you have domain name set up in your local /etc/hosts for your app you can use it instead:

redis-cli -h homestead.app

For Homestead 0.4 above. Due to redis security setting, it bind only for 127.0.0.1

In this case, you need to bind extra IP address.

  1. SSH to you server.

$sudo vi /etc/redis/redis.conf

Scroll to the line bind 127.0.0.1 add extra IP address 192.168.10.10, it will look like this

bind 127.0.0.1 192.168.10.10

save and exit.

  1. Restart redis server and exit your server.

$sudo /etc/init.d/redis-server restart

That's all, you should be able connect to your Homestead redis from your host.


  1. SSH to your server.

    $sudo vi /etc/redis/redis.conf

Scroll to the line bind 127.0.0.1 and change to 0.0.0.0, it will look like this

bind 0.0.0.0

save and exit.

  1. Restart redis server and exit your server.

    $sudo service redis-server restart

That's all, you should be able connect to your Homestead redis from your host.

redis-cli -h 192.168.10.10

SSH to the machine and open /etc/redis/redis.conf.

Find line which starts with bind directive, comment it out and save the file. Then restart redis-server with sudo /etc/init.d/redis-server restart.

Thanks to that Redis will listen for all connections from all available interfaces. You don't need any extra port forwarding.