duankuan5319 2017-08-08 17:42
浏览 128
已采纳

我可以在服务器的子目录中安装Laravel项目吗?

I have a website that was built with just good vanilla PHP, no frameworks, etc. I am now needed to add a blog to this website and I am wanting to use Laravel / Statamtic to do so. My question is this:

Can I install a Laravel project in a subdirectory of my server? For example, www.mywebsite.com/blog/. Ideally, everything in the blog directory would operate with my Laravel code. Everything outside of the blog directory would just continue to work as is. Is this possible?

And if it is possible, is there something special I need to do in my Ngnix config file?

  • 写回答

1条回答 默认 最新

  • doujie1908 2017-08-16 12:11
    关注

    All you would have to do is take the contents in the /public folder and put it in the desired subdirectory, so "yourwebsite/blog". Then move the contents from the root laravel folder to outside the root folder on the server, so basically everything that is left in the project after you remove public would then go into say "/var/www/" if your root folder is "/var/www/html". After that simply update the path to the autoloader and app.php in the index.php file, which was previously in your public folder but is now in your sub directory. Keep in mind if you do this all routes in the laravel app will have to have the subdirectory as part of any relative url, probably simple to solve this with a group.

    If you are simply looking to do a blog and already know PHP why not pick up wordpress and do a basic template for yourself? It's simple to pick up, a weekend maybe. If you consider it check out VCCW as a development environment.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播