You can follow this procdure
https://gist.github.com/mediabeastnz/4f6254d3d8df37de218f
Your production location must always be <(virtual)web server root>/public
Last question depends if you want to open staging server/tests to public?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Quick background: I have my first Laravel project locally. I have the files in a private repo on Github. I have successfully tested my SSH connection to Github and am able to deploy --bare repos, etc. I expect to make use of GitHub workflows. I've been mucking around with several different recommended processes (that are all very similar) but I remain lost regarding a few details.
My goal:
My questions:
Is the "production" location my /home/public_html/ folder? or is it /home/public_html/public? Or is it a part of my remote (my server) repo and I'm supposed to use some other means of linking my /home/public_html folder to that repo?
When do I turn the project files into a public build? Does that happen between local and staging? Or between staging and production?
Please and thank you.
@JessycaFrederick The easiest way to define what your document root directory is this: if you go to yourdomain.com, the file you see will be the first matched index file in the document root folder (that is, index.htm, index.php, default.asp, etc.). The document root is the topmost directory that the server exposes to the outside world – anything not inside that directory cannot be accessed from a browser. In your case, it sounds like your document root is /home/public_html.
Now the crux: The server’s document root folder should be Laravel’s public-facing folder, so the Laravel project as a whole should be uploaded into the parent folder of the document root, i.e., /home. Depending on what type of hosting and server access you have, there are two basic ways to then make sure that the server’s document root and Laravel’s public-facing folder refer to the same location:
/home/public and then upload your Laravel project to /home (the old /home/public_html will still be there, but will no longer be accessible from a browser, since it’ll be outside the document root). This requires permission to be able to change your server configuration and likely won’t work if you’re on regular shared hosting./home and then move all the files inside the /home/public folder into /home/public_html (note that this may overwrite files from your previous project – you should get those out of the way first, for instance by putting them into a subdirectory). Then do as described in this StackExchange answer to make Laravel recognise that every time something refers to the Laravel ‘public’ folder, it should look in /home/public_html.The first of these is best because it requires no further configuration: once you change the document root in your server settings, you’re good to go.
The second way is more of a bother, because your development and production environments will now be different – and so will your app service provider. In order to avoid that, you should also rename the /public folder to /public_html in your local development environment, make the same change to the AppServiceProvider as above, and then edit the server settings on your local server to use /path/to/project/public_html as the document root.
If you have subdomains with separate Laravel apps, these are treated completely separately. They will each have their own document root folders, which is where the other Laravel apps should be uploaded into. So you will have a structure like this:
/home
| // Contains your main Laravel application
|---/public(_html)
| | // Main document root; contains your main application’s index.php, etc.
|---/sub1
| | // Contains the Laravel app for sub1.example.com
| |---/public(_html)
| | | // Document root for sub1.example.com; contains index.php, etc.
|---/sub2
| | // Laravel app for sub2.example.com
| |---/public(_html)
| | | // Document root for sub2.example.com
Please or to participate in this conversation.