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

tjkalinowski's avatar

Help me understand how to deploy my App for production - config problem

Hello All,

I am new to Laravel and this is my first post. I have problem with deployment my app to hosting. I have Forbidden error or Not Found due to path problems.

Here is my steps how I did it:

  1. My Laravel app is working on Valet development environment on MacOS well at /Users/tomas/laravel/ekal and is available at http://ekal.dev locally. Database is mySQL at localhost.

  2. I did login to DirectAdmin v1.50.1 my hosting and created virtual domain "ekal.mydomain.com" located on server at path : /domains/mydomain.com/public_html/ekal/

  3. Compress local ekal app directory to ekal.zip file and FTP it to hosting under server path /domains/mydomain.com/public_html/ekal/ekal.zip

  4. I uncompress ZIP file to the same path.

  5. I did edit /domains/mydomain.com/public_html/ekal/.env file and change database setting to right one.

APP_URL=http://ekal.mydomain.com
DB_CONNECTION=mysql
DB_HOST=mydomain.com
DB_PORT=3306
DB_DATABASE=ekal
DB_USERNAME=ekal
DB_PASSWORD=secret
  1. I did export my database from local server to SQL file, and upload this to my hosting via PHPmyAdmin as database ekal.

  2. I edit file /domains/mydomain.com/public_html/ekal/config/app.php and change:

    'url' => env('APP_URL', 'http://ekal.mydomain.com'),

7. I change permissions to 777 for /domains/mydomain.com/public_html/ekal/storage/framework



That all.


When I open web browse and type URL ekal.mydomain.com i see Forbidden error 403.

When I open ekal.mydomain.com/public I see my APP first page. But when i click on any link like "/users/index" app try to load URL : ekal.mydomain.com/users/index.php and can't find it with error Not Found 404.

I have notice that, CSS files are not loaded. So i did move from 

/domains/mydomain.com/public_html/ekal/public/css 

to one level up to path 

/domains/mydomain.com/public_html/ekal/css 

and see that APP can now find the file app.css and web page have CSS elements in DOM.

This help me to load CSS files, but do not solve problem with others.




I did search for solution, and found that proper way for deploy app is to upload all files on level up over public_html directory. Like this:

cd /domains/mydomain.com/public_html/ekal
cd /domains/mydomain.com/public_html    <--------upload here
UPLOAD app files here
DELETE ekal
MOVE public -> ekal

But in my case i can't do that. 
I can't upload files to upper level. 
/domains/mydomain.com/public_html/ekal is root URL for ekal.mydomain.com
/domains/mydomain.com/public_html is root URL for whole virtual server, i can't modify it.

I can't edit apache.config files. 
I have only FTP access to hosting and DirectAdmin web admin.



My question is how to modify configuration of laravel APP itself to works? 



0 likes
4 replies
fabricecw's avatar

Hi @tjkalinowski

In general: Laravel is not something like Wordpress. You should be able to use terminal commands and stuff like this. Althought, it's possible to host it on a shared hosting.

You have to define the document root of ekal.mydomain.com to /domains/mydomain.com/public_html/ekal/public and upload the Laravel application to the /domains/mydomain.com/public_html/ekal directory.

The visitor only "sees" the public-folder. And from there, the application get's bootstraped.

Changing the document root should be possible in every hosting.

Furthermore, never apply 777 permissions! That's a big security breach.

Regards,

tjkalinowski's avatar

Hello fabricecw!

Thanks for replay. I do not have rights to define Document Root Directory for Apache HTTP server. My server path is /domains/mydomain.com/public_html/ekal and this is my document root and I cant change that. My URL is http://ekal.mydomain.com/.

By keep it in mind, can you help me to solve problem? If login page works, the any other page have too.

fabricecw's avatar
Level 7

You can try it with .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ekal.mydomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.ekal.mydomain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

But I'm not sure if this works fine... This simulates the document root to /public.

Please or to participate in this conversation.