Hola
Hola

Reputation: 2233

How to upload laravel project on subdomain?

I want to host a laravel project in a subdomain.. For that first First I create a subdomain name registraion.

And inside the publicm_html/registraion i upload the project file. enter image description here But when I see the project on url I saw only files not the project I stored.

enter image description here

what's the problem of uploading the laravel project? Can anyone help me to find it out?

Upvotes: 12

Views: 39289

Answers (4)

Fernando Sinaga
Fernando Sinaga

Reputation: 7

I think laravel project can be installed either in domain or in subdomain.

What need to pay attention when uploading your laravel project is, make sure there is nothing files (hidden) inside your subdomain directory. Delete all and upload your laravel project file or zip

Upvotes: 0

S Debasish Nayak
S Debasish Nayak

Reputation: 263

In my case i tried each and every solution available. But when I checked the log I found one error:

 production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified. at /home/******/public_html/**subdomain name*/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:44)
[stacktrace]

Then I searched for .env file in my project structure.(Check the hidden files list). In my project .env was not there by default only .env.example file was there.

so i created one .env and added

APP_NAME=Laravel
APP_ENV=local
APP_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=xxxxxxxxxxxxxxxxxxx
DB_USERNAME=xxxxxxxxxxxxxxxxxxx
DB_PASSWORD=xxxxxxxxxxxxxxxxxxx

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

I have generated one APP_KEY. For this I used

php artisan key:generate --show

Then I kept the key in the .env. Then Its done. Hope it may help someone

Upvotes: 0

Mahfuzul Alam
Mahfuzul Alam

Reputation: 3157

Do as what @Samundra mentioned. If you have confusion this is the place where you need to put public_html/registration/public in your cPanel -> Sub-Domain

enter image description here

Upvotes: 6

Samundra
Samundra

Reputation: 1907

Assuming you are using cPanel to create subdomain. Below are the general steps that are required to setup sub-domain for laravel-project.

  1. Create your sub-domain
  2. Upload your laravel project to the sub-domain home directory.
  3. After you have uploaded all the files. Update your sub-domain document-root to point to public_html/registration/public/ folder, you can do this from sub-domain manager inside cPanel see.

After following 1-3 steps you should see your laravel project. However you also need to setup proper file permissions on laravel's bootstrap, storage folder to get it up and running.

Let us know if this helps you or not.

Upvotes: 24

Related Questions