Lychee
Lychee copied to clipboard
Install in sub directory with mod_rewrite
Hello!
The documentation states that the web root directory should point to the "public" directory. Because I also host other stuff on my website I don't want this and installed Lychee to a sub directory. But this causes an error message when not the full path to "public" is used:

Than I've seen the instruction to create a symlink with Apache, which I cannot apply due to missing SSH access.
The root directory of the website is "/bla/blub/web", the installation directory of the Lychee is "/bla/blub/web/pics". Finally I decided to use an approach with a rewrite, the file "/bla/blub/web/pics/.htaccess" contains:
RewriteEngine on
RewriteRule ^ /pics/public/ [L]
Is that secure? Can we therefore add something like this to the FAQ? It already mentions something similar for NGINX already.
Thanks
Is that secure?
Honestly I don't know. What I do know, is that you DO NOT WANT your .env to be readable from the exterior (and potentially other files...)
It looks like it is possible: https://stackoverflow.com/questions/30497575/install-laravel-5-app-in-subdirectory-with-htaccess
Though I did not try to make it work.
This however sound a way more secure way of doing it. https://laravel-news.com/subfolder-install
And if you still need to expose your lychee folder to the web, I highly suggest you to create a random string from a sha256 hash and use it as folder name. This will minimize the chances of it being found by a web crawler.
Since the ticket is still open I assume this has not been solved, or documented yet. I have my Lychee-Laravel installation setup in a subfolder. This information is for Apache 2.4.
I have installed Lychee-Laravel in /srv/www. However this can be any directory. The directory must be readable by the user of the webserver. But only the public folder should be served by the webserver. Other folders may contain information you don't want to expose (.env file with keys and passwords). I have not set /srv/www as DocumentRoot.
Alias /photo /srv/www/Lychee-Laravel/public/
<Directory /srv/www/Lychee-Laravel/public/>
Options FollowSymLinks
AllowOverride all
Require all granted
</Directory>
The FollowSymLinks option must be set for the RewriteRule in the .htaccess in the public folder.
Hope this helps.
@jsaathof Nice!
I use Gandi's PaaS service to host php applications like Lychee and I'm trying to upgrade my v3 to current.
I cannot change the DocumentRoot; all vhosts on my tenant/instance are like /lamp0/web/vhosts/lychee-site.domain.com/htdocs and I'm not sure on the best path forward. I'm open to suggestions, even if I wanted to use a new instance entirely I don't know the best way for this application to be installed under that sort of circumstance.
Done.