我正在努力将Laravel项目部署到域子文件夹...这里是完整的#34;故事":
我的老师可以控制机器:http://ilp.fe.up.pt/
他为我创建了一个名为 mitocondrias 的用户,所以我可以通过 ssh 来使用它:
ssh mitocondrias@ilp.fe.up.pt
他还将通常的public_html
文件夹设置为仅html
。
总而言之,如果我在index.html
创建一个简单的 hello world /home/mitocondrias/html/
,我可以在http://ilp.fe.up.pt/mitocondrias/成功查看
现在,关于Laravel部署,这就是我所做的:
我将名为CoExpr
的Laravel项目克隆到我的用户主页:/home/mitocondrias/coexpr
我删除了html
文件夹,并使用以下命令创建了一个名为symlink
的{{1}} /home/mitocondrias/coexpr/public
:
html
所以,这是最终的树结构:
mitocondrias@ilp:~$ ln -s ~/coexpr/public/ html
我还运行了以下命令来设置正确的Laravel权限:
ilp.fe.up.pt/ (the root of my teacher web hosting)
|
|-- mitocondrias/ (my user home, aka /home/mitocondrias)
| |
| |-- coexpr/ (the Laravel project)
| | |
| | |-- [...]
| | |-- public/
| | |-- [...]
| |
| |-- html/ (this is actually not a folder,
| | but a symlink to /home/mitocondrias/coexpr/public/)
chmod -R 755 coexpr/
完成所有这些后,我可以在以下位置成功查看目标网页:http://ilp.fe.up.pt/mitocondrias/(如果我使用chmod -R o+w storage
投放应用,则相当于localhost:8000
)
但是当我尝试使用其他路线时,例如:http://ilp.fe.up.pt/mitocondrias/explorer(相当于php artisan serve
),我得到:
localhost:8000/explorer
我做错了什么..?
如果这是相关的,404 Not Found
The requested URL /home/mitocondrias/html/index.php was not found on this server.
中的.htaccess
就像使用作曲家创建Laravel项目时生成的那样 - 我没碰到它:
/home/mitocondrias/coexpr/public/
由于<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
,这也是symlink
的{{1}}。
所以,那就是...... Aff,这是一篇很长的帖子......提前致谢!
答案 0 :(得分:1)
This related question提供调试提示:检查路由是否与/index.php/
一起使用,以查看问题是否与.htaccess
相关。
正在加载http://ilp.fe.up.pt/mitocondrias/index.php/explorer!
由于某种原因,您的.htaccess
无效。
如果in this answer指出另一个相关问题,或许只是启用它就可以解决您的问题。