[英]Deploy Laravel 5 using only FTP in a shared hosting
I need to deploy a laravel 5 project to a client host. 我需要将laravel 5项目部署到客户端主机。
The plan of my client is basic hosting: Linux + MySql without cpanel or similar (ie no admin panel). 我的客户端的计划是基本托管:没有cpanel或类似的Linux + MySql(即没有管理面板)。
I have access only via ftp and only to a folder named www.mycustomerweb.com. 我只能通过ftp访问,只能访问名为www.mycustomerweb.com的文件夹。 It means I can not create a directory at the same level of www.mycustomerweb.com folder. 这意味着我无法在www.mycustomerweb.com文件夹的同一级别创建目录。 Only inside it (I think it is called shared hosting). 只在它里面(我认为它被称为共享主机)。
One year ago, I deployed a project made with Laravel 4 this way: 一年前,我用这种方式部署了一个用Laravel 4制作的项目:
My questions are: 我的问题是:
Did I do everything all right with laravel 4 project? 我用laravel 4项目做了一切吗? May I have fallen into security issues (I mean, is the site safe)? 我是否已陷入安全问题(我的意思是,网站是否安全)?
How do I deploy a laravel 5 project to the same site? 如何将laravel 5项目部署到同一站点? In Laravel 5 I can not get rid of public folder as I did with Laravel 4. 在Laravel 5中,我无法像Laravel 4那样摆脱公共文件夹。
Right now, I have set up a fresh installation of Laravel 5 on localhost and then I have uploaded all files to www.myclientweb.com folder via ftp: 现在,我在localhost上设置了Laravel 5的全新安装,然后我通过ftp将所有文件上传到www.myclientweb.com文件夹:
Surely this is not the right way... 当然这不是正确的方法......
I've had a long searching through the web and Stackoverflow with no luck. 我已经在网上和Stackoverflow上进行了长时间的搜索而没有运气。
Really apprecite any help. 真的很感激任何帮助。
Thanks for reading. 谢谢阅读。
edit require __DIR__.'/../bootstrap/autoload.php';
编辑require __DIR__.'/../bootstrap/autoload.php';
into require __DIR__.'/protected/bootstrap/autoload.php';
进入require __DIR__.'/protected/bootstrap/autoload.php';
also edit $app = require_once __DIR__.'/../bootstrap/app.php';
还要编辑$app = require_once __DIR__.'/../bootstrap/app.php';
into $app = require_once __DIR__.'/protected/bootstrap/app.php';
进入$app = require_once __DIR__.'/protected/bootstrap/app.php';
UPDATE UPDATE
This is a risky process. 这是一个冒险的过程。 By using this, you give malicious users permissions to find bugs. 通过使用此功能,您可以为恶意用户授予查找错误的权限。 like, http://project-url/storage/logs/laravel.log is still open. 比如, http://project-url/storage/logs/laravel.log仍然是开放的。
Previous Answer: 上一个答案:
Those who hardly check the comments, @Andrew F. has already given the answer. 那些几乎没有检查评论的人,@安德鲁F.已经给出了答案。
but he missed some other files like composer and package. 但他错过了其他一些文件,如作曲家和包。
Formatted answer is: 格式化答案是:
RewriteRule ^(server\\.php|gulpfile\\.js|\\.env|composer.*|package.*) - [F,L,NC] RewriteRule ^(server \\ .php | gulpfile \\ .js | \\ .env | composer。* | package。*) - [F,L,NC]
L4和L5之间没有区别,所以你对L4做了同样的事情。
If you are trying to run Laravel 5.1 into a shared hosting space or you are trying to put your laravel 5/5.1 into a sub directory on your shared hosting so you can access it like this: 如果您尝试将Laravel 5.1运行到共享主机空间,或者您尝试将laravel 5 / 5.1放入共享主机上的子目录中,那么您可以像这样访问它:
http://mywebsite.com/mylaravel/
So this answer is for you, first of all make sure you meet 所以这个答案适合你,首先要确保你见面
Laravel 5.1 requirements : Laravel 5.1要求:
- PHP 5.5
- PHP extension Mcrypt
- PHP extension Mbstring
- PHP extension OpenSSL
Here two tutorials for you : 这里有两个教程:
In Apache, you can achieve this something like 在Apache中,你可以实现这样的功能
RewriteEngine on
RewriteBase /
# Rewrites all URLS without blog in them
RewriteCond %{REQUEST_URI} !^/blog/
# Rewrites all URLS [Replace "example" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?example\.
# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /blog/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.