简体   繁体   English

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

[英]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.

相关问题 如何将本地Laravel Web项目上传到服务器? - How can I upload my local Laravel web project to server? 如何组织laravel项目的github存储库,以便用户轻松安装和运行它? - How can I organize my laravel project's github repository so that users can easily install and run it? 如何安装和配置现有的 Laravel 项目? (拉维尔 4) - How I can install and configure an existing Laravel Project? (Laravel 4) 我的电脑有两个 php 文件夹,所以我要么无法连接到 SQL Server,要么无法安装 Laravel - My computer has two php folders so I either can't connect to SQL Server or install Laravel 如何在我的 Laravel 项目中安装 PHP 统计扩展? - How do I install PHP Statistics extension in my Laravel Project? 我正在尝试在我的项目中安装 InfyOm Laravel Generator - I'm trying to install InfyOm Laravel Generator in my project 我无法使用 PHP 7.3 在实时服务器上安装我的 laravel 8 应用程序 - I failed to install my laravel 8 app on live server with PHP 7.3 如何连接laravel服务器? - how can i connect my laravel server? 将我的 Laravel 项目上传到服务器后出现错误 - I am getting error after uploading my Laravel project to server 如何在我的 Laravel 框架中安装 html 主题 - How can i install html theme in my laravel framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM