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

TheFriendlyHacker's avatar

Redis queue on a different server

I have two VPS servers. I plan on hosting the app on one of them, and using the other one to process large queued jobs via Redis.

My main question is, do I need to install my Laravel app on both servers, or just on the main one that will be hosting the application?

Thanks!

0 likes
5 replies
cvollmann's avatar

You only have to install Redis on your dedicated server as your application is "talking" with the Redis backend via "illuminate/redis" package.

Remember to change your config to use your new Redis server.

'redis' => [

    'cluster' => false,

    'default' => [
        'host'     => 'ip-of-your-dedicated-server',
        'port'     => 6379,
        'database' => 0,
    ],

],
1 like
slashequip's avatar

Hey, @TheFriendlyHacker,

@cvollmann is right if your dedicated server is just storing your queue but if you wanting a dedicated server to run jobs then that is a little different.

You will need your codebase deployed to both servers. Your 'app' server will run like a normal website. Your 'processing' server will have Redis installed and your codebase deployed to it as well.

Configure both server's environments to point to the correct Redis server (as @cvollmann has said).

Now if you are using regular job processing then you need to use something like Supervisor to keep your job queue running, see: https://laravel.com/docs/5.5/queues#running-the-queue-worker

Your other alternative if you are already using Redis would be to look into Laravel Horizon to manage your queues for you.

You only run the queue worker on your 'processing' server this keeps the 'app' server free to serve your app to the masses.

Hope that helped?

1 like
TheFriendlyHacker's avatar

@haganjones That definitely helps!

So, if I am interpreting what you said correctly, I would need to install my Laravel application on both servers, correct?

Also, thanks for pointing me to Laravel Horizon! I wasn't even aware of it until now!

slashequip's avatar
Level 6

@TheFriendlyHacker yes on both servers but only one needs to be web accessible.

It would be good to use something like Laravel Envoyer to manage your deployments as you can deploy to multiple servers at the same time - super handy!

Also just to add to this, don't over complicate your app too early on. Managing multiple servers isn't that easy and if you don't NEED it yet then don't do it. You might find that one decent server can handle the jobs in the background just fine without the need to have a separate server.

Personally I have jobs for PDF processing which can be quite heavy but have never needed to have multiple servers for it - you'd be surprised at what these little VPS's can handle!

cvollmann's avatar

I want to clarify that I've read your question wrong/differently. Sorry!

If you would like to put only the queue to another server (as your title suggests) you don't need you application stack. But for "processing" your stuff @haganjones answer is of course absolutely right.

+1 on the suggestion not to overcomplicate things too early.

1 like

Please or to participate in this conversation.