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.

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?