May Sale! All accounts are 40% off this week.

WallyJ's avatar

Deployment of Laravel app to VPS

I am about to deploy a Laravel App to a VPS. The app will live on a subdomain and a separate account for the subdomain has been created via WHM, so it has it's own CPanel and directory structure.

My question is: Where do I upload all of the files?

Do I treat the project "public" directory like the "public_html" directory on the server and place all files and subfolders accordingly?

And if so, does the app treat the names "public" and "public_html" the same?

0 likes
4 replies
AndreaGiuseppe's avatar

Hi WallyJ,

you should upload your app inside a folder /var/www/vhosts/your-folder-name but that may depends on your preference.

After this you have to point your sub.domain.x to your path-to/foldername/public.

What have you done so far?

WallyJ's avatar

Nothing, besides create the account. Which, the standard CPanel account has a default folder structure that looks something like this:

(/home/coolapp)

.cpaddons

.cpanel

.cphorde

.htpasswds

.imh

.spamassassin

.ssh

.trash

etc

logs

mail

perl5

public_ftp

public_html

ssl

tmp

wordpress-backups

where "coolapp" is the name of the account created in WHM and where "public_html" sits in the root folder.

My understanding is that, since the public_html folder is public facing, that the root folder should hold all app files, .env, etc. so that the public can't reach them, but the app can, and that the public_html folder acts as the Laravel "public" folder, but I'm sure something needs to be done for that to work.

AndreaGiuseppe's avatar

good, you probably need to configure apache webserver to serve you app root. Take a look at cPanel services configurations, apache configuration -> global configurations and setup your httpd.conf file.

You can choose a folder like /www/sub.domain.xx (upload laravel there inside) and point apache to /www/sub.domain.xx/public

WallyJ's avatar

I've also ready about using mod rewrite to perform a 301. Would that have the same effect or not?

Please or to participate in this conversation.