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

Mdp85's avatar

Deploying laravel app on web server

Hello guys, I want to know what's the best way to deploying a laravel app on web server. In particular to put the configuration files and the public directory if they are both in the same root directory.

0 likes
6 replies
sid405's avatar

Ciao @Mdp85

what do you mean config and public in the same folder?

Have you modified the original file structure? If so in what way?

Could you take a screenshot of your source tree?

Best, sid

Mdp85's avatar

No, I have all the files in the same directory, the root directory of my web server, with a .htaccess file that makes it point requests to the public directory, know what I mean?

jjosephs's avatar

In the Cpanel or which server administration panel you're using, make the laravel "public" folder the root directory in the settings.

sid405's avatar

@Mdp85 Is this a shared server? Do you have to point to a 'public_html' directory or something?

The idea is that you need to configure apache (or whatever other webserver for that matter to point at the laravel /public folder.

Because that is the binding of laravel- Then again it can be overriden of that is what you need.

Let me know

Mdp85's avatar

I know about the binding, it's a shared server. But i'd like to know if there is some risk to have all file in the same directory, understood ?

sid405's avatar

About exposing it to the user? The user is mean to access just /public, with css, js and images in it. Nothing else.

Your config files don't go in there.

But maybe i'm misunderstanding. That's why i said if you've modified the tree, please a screenshot- If you have not moved files around compared to what the default structure is, point your werserver config to /public and you're fine.

Please or to participate in this conversation.