Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TonsOfLaz's avatar

Can I run Laravel Dusk on my Forge server?

Hi, I have been trying for a few days to get Laravel Dusk to run on my new Forge server (php 7.1, just provisioned, etc). My workflow includes a staging environment on the Live server, so i would like to be able to run my tests there.

Is there an accepted way to do this? With default settings, I get the error:

Failed to connect to localhost port 9515: Connection refused

I have tried a few things, but no success so far. Have you found a reliable way to do this? Thanks

0 likes
3 replies
ohffs's avatar

You should be able to hook something up with xvfb.

TonsOfLaz's avatar
TonsOfLaz
OP
Best Answer
Level 2

User amochohan on this page: https://github.com/laravel/dusk/issues/50

Has typed a series of (complicated) steps that worked for me! Thank you

# makes sure all your repos are up to date
sudo apt-get update
# chrome dependencies I think
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
# chromium is what I had success with on Codeship, so seemed a good option
sudo apt-get install chromium-browser
# XVFB for headless applications
sudo apt-get -y install xvfb gtk2-engines-pixbuf
# fonts for the browser
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
# support for screenshot capturing
sudo apt-get -y install imagemagick x11-apps

# Once all this has run through, you need to fire up xvfb on your homestead box. If you’re planning to # do this on a regular basis, you’ll want to get this setup on boot, but for the sake of testing things out:
Xvfb -ac :0 -screen 0 1280x1024x16 &
1 like

Please or to participate in this conversation.