Chud37
Chud37

Reputation: 5007

Git Clone Laravel Website just displays files and directories

I'm still really new to Git version control and Laravel. But I have gotten so far, and I'm not sure now where I am going wrong.

I set up VirtualBox and Vagrant on my local windows machine and installed homestead successfully. I have managed to get my Laravel website (it's only one page at the moment as I learn things) working correctly, it displays the header and the footer and the images load and everything. So that's all good.

So now, I have my Laravel website set up within my virtual vagrant server. On this server, the directory for my website is:

/home/vagrant/Code/sites/public_html

No when I cd to that directory, I ran the following:

git init
get remote add origin https://user@repo/user/publichtml.git
git add *
git commit -m "Initial Commit"
git push -u origin master

(I've substituted user@repo instead of the real URL)

All went through successfully. Great. So now on my live server I ran the following:

cd /home/sites/public_html
git init
git clone https://user@repo/user/publichtml.git

Which again, worked fine. It downloaded all the files into the public_html directory which is great. So then I go to visit the website and this is what I get:enter image description here

The only explanation for this happening is maybe I need to install something on the server before I clone these files to it. I guess the files in the Laravel folder won't run by themselves? Do I need to install composer and laravel on the server or something? If so, how do I do that, and why don't they run on their own?

I cannot see a .htaccess or index.php in the root directory so I am not sure how it runs anyway.

Upvotes: 0

Views: 401

Answers (2)

M. Eriksson
M. Eriksson

Reputation: 13635

You should install Laravel using composer instead.

composer create-project laravel/laravel mysite

You should also point the document root on your web server to laravels "/public" folder, making the framework code reside outside of the document root. That's good for security (no one can access any framework code, like your configs etc directly).

You will then find the .htaccess-file in the /public folder.

Please read the Laravel documentation about the different but recommended ways to install Laravel.

Btw, doesn't homestead use Nginx instead of Apache? In that case, .htaccess isn't even used. Please refer to the Laravel documentation again regarding homestead.

Upvotes: 1

Dymen1
Dymen1

Reputation: 736

You need to redirect traffic to public/index.php instructions for this are webserver dependent.

Upvotes: 0

Related Questions