From da918c97cf11d159c099ca1b4e4dd404fbe950a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=9Do=E2=9C=9D?= <35490779+01tot10@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:33:58 +0300 Subject: [PATCH] Add instructions for hosting Lychee in a subpath with Apache (#103) * Add instructions for serving Lychee in a subpath with Apache * Fixing syntax towards uniform style. --- docs/advanced-setups.md | 59 ++++++++++++++++++++++++++++++++++++++++ docs/faq_installation.md | 3 +- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/docs/advanced-setups.md b/docs/advanced-setups.md index dc92495d..88daae65 100644 --- a/docs/advanced-setups.md +++ b/docs/advanced-setups.md @@ -290,4 +290,63 @@ To avoid latency when clicking Diagnostics, my suggestion is to disable BasicPer ### Limitations to be considered As explained before, recursive tasks are penalised in Object Storage, so if you have an existing bucket and the container runs for the first time, it will take long time to review and set the permissions in your mount. Depending on the number of photos, it can take several hours. +## Hosting Lychee in a subpath with Apache + +To serve Lychee in a subpath, e.g. `https://my.url/photos/`, we can use Apaches's [Alias](https://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias)-directive. + +In this example we assume the web root to be located at `/var/www/html`, the web user and group to be `www-data`, and install [from the master branch](installation.html#from-the-master-branch). + +Before getting started, make sure your system qualifies the [Server Requirements](installation.html#server-requirements). + +### Setup Lychee + +Clone the repository to outside the web root, e.g. `/var/www/`: + +```bash +sudo git clone https://www.github.com/LycheeOrg/Lychee /var/www/ +``` + +Set the file ownership and permissions: + +```bash +sudo chown -R www-data:www-data /var/www/Lychee +sudo chmod -R 2775 /var/www/Lychee +``` + +Install composer in `/var/www/Lychee` as instructed in [here](https://getcomposer.org/download/). Then, from `/var/www/Lychee`, install the project dependencies: + +```bash +sudo -u www-data php composer.phar install --no-dev +``` + +### Setup Apache + +Link `https://my.url/photos/` to `/var/www/Lychee/public` by adding the following to your Apache configuration for Aliases. In Apache 2.4 running on Debian, the correct configuration file is `/etc/apache2/mods-available/alias.conf`. + +```apacheconf +Alias /photos /var/www/Lychee/public + + + Options FollowSymLinks + AllowOverride All + Require all granted + +``` + +Finally, restart Apache: + +```bash +sudo service apache2 restart +``` + +### Configure Lychee + +At this point, you should be able to go to `https://my.url/photos/` and run the web installer. During the installation procedure, on top of adding the database credentials to match your setup, set your `APP_URL` to the served subdirectory: + +```bash +APP_URL=https://my.url/photos/ +``` + +Done! + diff --git a/docs/faq_installation.md b/docs/faq_installation.md index 95d1a602..420102a3 100644 --- a/docs/faq_installation.md +++ b/docs/faq_installation.md @@ -61,8 +61,7 @@ location @lychee { ### Can I host Lychee with a subpath with Apache? Like `https://example.dev/lychee/` -Yes, just create a Symbolic Link and allow your apache configuration to follow them. -At website.com root `ln -s Lychee/public pics` and you will get exactly what you want: `website.com/pics` +Yes, the process is described [here](advanced-setups.html#hosting-lychee-in-a-subpath-with-apache). ### Do we really need writable `app/`?