[英]Can I install a Laravel project in a subdirectory of my server?
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. 我有一个网站,仅使用良好的原始PHP构建,没有框架等。现在我需要向该网站添加博客,而我想使用Laravel / Statamtic来做到这一点。 My question is this:
我的问题是这样的:
Can I install a Laravel project in a subdirectory of my server? 我可以在服务器的子目录中安装Laravel项目吗? For example, www.mywebsite.com/blog/.
例如,www.mywebsite.com / blog /。 Ideally, everything in the
blog
directory would operate with my Laravel code. 理想情况下,
blog
目录中的所有内容都可以使用我的Laravel代码运行。 Everything outside of the blog
directory would just continue to work as is. blog
目录之外的所有内容都将继续按原样工作。 Is this possible? 这可能吗?
And if it is possible, is there something special I need to do in my Ngnix config file? 如果可能,我的Ngnix配置文件中是否需要做一些特别的事情?
All you would have to do is take the contents in the /public folder and put it in the desired subdirectory, so "yourwebsite/blog". 您所要做的就是将/ public文件夹中的内容放入所需的子目录中,即“ 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".
然后将内容从laravel根目录文件夹移到服务器上的根目录之外,因此,如果您的根目录文件夹是“ /”,那么基本上删除公共项目后项目中剩下的所有内容都会变成“ / var / www /”无功/ 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.
之后,只需将index.php文件中的autoloader和app.php路径更新为以前在您的公用文件夹中,但现在在您的子目录中。 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.
请记住,如果执行此操作,则laravel应用中的所有路由都必须将子目录作为任何相对URL的一部分,可能很容易通过组来解决。
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? 如果您只是想做一个博客并且已经知道PHP,为什么不选择wordpress并自己做一个基本模板呢? It's simple to pick up, a weekend maybe.
接机很简单,也许是一个周末。 If you consider it check out VCCW as a development environment.
如果您认为它适合VCCW作为开发环境。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.