Intro
I am struggling to deploy a Laravel project to a domain subfolder... Here's the complete "story":
My teacher has control of the machine at: http://ilp.fe.up.pt/
He created a user for me called mitocondrias so I could use it via ssh like:
ssh mitocondrias@ilp.fe.up.pt
He also set the usual public_html
folder to be called html
only.
So, to sum up, if I create a simple hello world index.html
at /home/mitocondrias/html/
I can successfully see it at http://ilp.fe.up.pt/mitocondrias/
What I did
Now, regarding the Laravel deploy, here is what I did:
I cloned my Laravel project called CoExpr
to my user home: /home/mitocondrias/coexpr
I deleted the html
folder and created a symlink
to /home/mitocondrias/coexpr/public
called html
with the following command:
mitocondrias@ilp:~$ ln -s ~/coexpr/public/ html
So, here is the final tree structure:
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/)
I also ran the following commands to set the correct Laravel permissions:
chmod -R 755 coexpr/
chmod -R o+w storage
The problem
After all this, I can successfully see the landing page at: http://ilp.fe.up.pt/mitocondrias/ (the equivalent of localhost:8000
if I were serving the app with php artisan serve
)
But when I try to use other routes, like: http://ilp.fe.up.pt/mitocondrias/explorer (the equivalent to localhost:8000/explorer
) I get:
404 Not Found
The requested URL /home/mitocondrias/html/index.php was not found on this server.
What did I do wrong..?
Extra info
In case this is relevant, the .htaccess
in /home/mitocondrias/coexpr/public/
is as it was generated upon the Laravel project creation with composer - I did not touch it:
<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>
And because of the symlink
, this is also the .htaccess
at /home/mitocondrias/html/
.
End
So, that's it... Aff, this was a long post... Thanks in advance!