用户
 找回密码
 入住 CI 中国社区
搜索
查看: 16721|回复: 8
收起左侧

Laravel如何部署在虚拟主机的空间中

[复制链接]
发表于 2013-9-3 16:22:09 | 显示全部楼层 |阅读模式
Laravel如何部署在虚拟主机的空间中,求方法!

如果必须使用主机或vps,成本自然提升。
发表于 2013-9-3 17:50:52 | 显示全部楼层
把vendor也传上去
发表于 2013-9-3 17:54:12 | 显示全部楼层
你的疑问应该来自于 Laravel 使用 composer 作为依赖包管理工具。

所以做法如楼上所述,你在本地将所有调试好的源文件目录,包括 composer 生成的所有文件,通过 FTP 上传到你的虚拟主机即可。
 楼主| 发表于 2013-9-5 09:42:58 | 显示全部楼层
saturn 发表于 2013-9-3 17:54
你的疑问应该来自于 Laravel 使用 composer 作为依赖包管理工具。

所以做法如楼上所述,你在本地将所有调 ...

难道url要通过 http://www.domain.com/public 来访问?
毕竟虚拟空间无法将目录绑定到 public 目录上。
发表于 2013-9-5 15:05:45 | 显示全部楼层
wanganlin21 发表于 2013-9-5 09:42
难道url要通过 http://www.domain.com/public 来访问?
毕竟虚拟空间无法将目录绑定到 public 目录上。 ...


是的,如果不支持 htaccess 那就放弃吧。

PS:现在还有不支持 htaccess 的主机???
发表于 2014-2-19 13:13:59 | 显示全部楼层
saturn 发表于 2013-9-5 15:05
是的,如果不支持 htaccess 那就放弃吧。

PS:现在还有不支持 htaccess 的主机??? ...

他只是可能不知道可以这样干。。。
发表于 2014-3-20 11:16:49 | 显示全部楼层

This solution enables you to drop Laravel into your public folder then use a .htaccess file to redirect requests to the public folder. This solution places your application and core system code into a publicly accessible folder. This is not something that we encourage you to do with any PHP framework.

Step 1. Place Laravel in your document root folder.

Step 2. Place the following .htaccess file in your document root folder.

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Step 3. Make sure that you manually set your 'url' configuration in application/config/application.php otherwise Laravel will generate incorrect URLs. Make sure that each of your environments have the correct application.url configuration. For more information on environment-specific configurations see: http://laravel.com/docs/install#environments

That's all.


发表于 2014-8-12 10:39:52 | 显示全部楼层
Rongge 发表于 2014-3-20 11:16
This solution enables you to drop Laravel into your public folder then use a .htaccess file to redir ...

這個方法可以作用!!!
如果是
http://example.com/public/
可以直接將路徑改成
http://example.com/

但是我想請教另個問題!!!
如果是
http://example.com/Fantasy/public/
用同個方法好像無法修改成
http://example.com/Fantasy/
想請問有無這樣的方法!!!!
感謝
发表于 2014-9-10 13:59:59 | 显示全部楼层
现在的虚拟主机大部分 php版本 不支持laravel

本版积分规则