douzao2992 2017-05-18 07:24
浏览 55

Git Clone Laravel网站只显示文件和目录

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.

  • 写回答

2条回答 默认 最新

  • dongxu7121 2017-05-18 07:36
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。