# Lighttpd - symbolic link configuration

**URL:** https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186
**Category:** General Discussion
**Tags:** lighttpd
**Created:** [8 December 2022 09:27 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186 "2022-12-08T09:27:24Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 09:27 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/1 "2022-12-08T09:27:24Z")

</div>

Hello DietPi community,

I installed Aria2 with `dietpi-software`, everything works fine - I have access to the lighttpd server with my ip, so far so good.

I created a symbolic link from the Aria2 download folder to `/var/www` .

```auto
[root@DietPi:~]# ln -s /mnt/dietpi_userdata/downloads /var/www/downloads
[root@DietPi:~]# ls /var/www
apc.php aria2 downloads index.lighttpd.html opcache.php phpinfo.php
[root@DietPi:~]#

```

However, I don’t know what permission to give to the directory`downloads` to be able to access it with `<my ip>/downloads` from my browser, without blocking access to the `downloads` in `/mnt/dietpi_userdata/downloads` used by Aria2 for downloads.

At the moment when I type in the address bar of my browser `<my ip>/downloads` I get an error message 403 Forbidden.

A little help would be appreciated - thank you all. 🤙

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [8 December 2022 14:47 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/2 "2022-12-08T14:47:03Z")

</div>

I think you get 403 error because there is no `index.php/html` in this directory and dir listening is not enabled.

You can create a new config file with the dir-listening rule, enable this config file and reload lighttpd

```auto
touch /etc/lighttpd/conf-available/99-dir-list-downloads.conf
echo '$HTTP["url"] =~ "^/downloads($|/)" { server.dir-listing = "enable" }' >> /etc/lighttpd/conf-available/99-dir-list-downloads.conf
lighty-enable-mod dir-list-downloads
service lighttpd force-reload

```

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 14:51 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/3 "2022-12-08T14:51:21Z")

</div>

hello @Jappe

Thank you for your answer, so can I delete the symbolic link I made? or should I leave it? before creating this one.  
thx

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [8 December 2022 15:28 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/4 "2022-12-08T15:28:52Z")

</div>

No, leave the link, but I tried to recreate your config and I found an issue.  
With your command `ln -s /mnt/dietpi_userdata/downloads /var/www/downloads` you will get a folder inside downloads like `/var/www/downloads/downloads`, which is maybe not what you want to achieve?  
If you want the files from inside `/mnt/dietpi_userdata/downloads` to be shown in `/var/www/downloads` (like you have a file `movie.mp4` inside your original downloads folder and you want to access it via `/var/www/downloads/movie.mp4`) you need to modify the syntax of the command, but first let’s remove the false link

```auto
rm /var/www/downloads/downloads

```

and create the right one

```auto
ln -s /mnt/dietpi_userdata/downloads /var/www/

```

Then it is important that anybody can read these files, so let’s check this with

```auto
ls -la /mnt/dietpi_userdata/downloads

```

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 15:48 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/5 "2022-12-08T15:48:10Z")

</div>

@Jappe , yes …ok I’ll do that right now and come back for feedback,

thanks for your answer …

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 16:04 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/6 "2022-12-08T16:04:33Z")

</div>

@Jappe

```auto
[root@DietPi:~]# touch /etc/lighttpd/conf-available/99-dir-list-downloads.conf
[root@DietPi:~]# echo '$HTTP["url"] =~ "^/downloads($|/)" { server.dir-listing = "enable" }' >> /etc/lighttpd/conf-available/99-dir-list-downloads.conf
[root@DietPi:~]# lighty-enable-mod dir-list-downloads
Enabling dir-list-downloads: ok
Run "service lighttpd force-reload" to enable changes
[root@DietPi:~]# service lighttpd force-reload
[root@DietPi:~]# rm /var/www/downloads/downloads
rm: impossible de supprimer '/var/www/downloads/downloads': Aucun fichier ou dossier de ce type
[root@DietPi:~]# ln -s /mnt/dietpi_userdata/downloads /var/www/
[root@DietPi:~]# ls -la /mnt/dietpi_userdata/downloads
total 3955048
drwxrwxr-x 2 dietpi dietpi 4096 8 déc. 16:25 .
drwxrwxr-x 7 dietpi dietpi 4096 8 déc. 08:51 ..
-rw-rw-r-- 1 aria2 dietpi 0 8 déc. 16:25 aria2.session
-rw-rw-r-- 1 aria2 dietpi 1246226056 8 déc. 09:13 coolmovie.mkv
-rw-rw-r-- 1 aria2 dietpi 1310228092 8 déc. 06:00 movie01.mkv
-rw-rw-r-- 1 aria2 dietpi 888166194 8 déc. 05:57 another_movie.mkv
-rw-rw-r-- 1 aria2 dietpi 605317719 8 déc. 15:40 some_great_movie.mkv
[root@DietPi:~]#

..all is there ..

```

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [8 December 2022 16:13 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/7 "2022-12-08T16:13:45Z")

</div>

Looks good, you should be able now to access it via `<my ip>/downloads`

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 16:24 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/8 "2022-12-08T16:24:05Z")

</div>

no - 403 Forbidden ( but I didn’t reload lighttpd so maybe that’s it ? )

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [8 December 2022 16:25 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/9 "2022-12-08T16:25:16Z")

</div>

The command `service lighttpd force-reload` reloaded lighttpd.  
Can you show `ls -la /var/www`

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 16:30 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/10 "2022-12-08T16:30:52Z")

</div>

```auto
[root@DietPi:~]# service lighttpd force-reload
[root@DietPi:~]# ls -la /var/www
total 1304
drwxr-xr-x 3 root root 4096 8 déc. 17:02 .
drwxr-xr-x 12 root root 4096 30 nov. 20:39 ..
-rw-r--r-- 1 root root 43952 8 déc. 08:50 apc.php
drwxrwxr-x 5 root root 4096 1 sept. 2021 aria2
lrwxrwxrwx 1 root root 30 8 déc. 17:02 downloads -> /mnt/dietpi_userdata/downloads
-rw-r--r-- 1 root root 395 8 déc. 14:35 index.lighttpd.html
-rw-r--r-- 1 root root 991709 8 déc. 13:19 iRMGD1l.gif
-rw-r--r-- 1 root root 196593 8 déc. 14:27 jPjdgDQ.jpg
-rw-r--r-- 1 root root 76158 8 déc. 08:50 opcache.php
-rw-r--r-- 1 root root 20 8 déc. 08:50 phpinfo.php
[root@DietPi:~]#

```

403 Forbidden after `service lighttpd force-reload`

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [8 December 2022 16:50 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/11 "2022-12-08T16:50:13Z")

</div>

🤔  
`/mnt/dietpi_userdata/downloads` is readable, also `/var/downloads`.  
The module `mod_dirlisting` is loaded by default and don’t has to be activated in any config.

Let’s make sure the content of the created config is right:  
`cat /etc/lighttpd/conf-available/99-dir-list-downloads.conf`

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 16:51 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/12 "2022-12-08T16:51:46Z")

</div>

Yeeeep ! - after a restart I have access to the page `downloads` - I’m just doing a test download with **Aria2** …- I’ll be right back for feedback … I think we’re good. … I’ll be back. 🤙

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [8 December 2022 16:54 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/13 "2022-12-08T16:54:18Z")

</div>

Nice!  
Did you restart lighttpd or the whole device?  
In my test it was working just with `service lighttpd force-reload` 🤷

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 17:02 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/14 "2022-12-08T17:02:42Z")

</div>

so :

- Aria2 can download  
-`Index of /downloads/`  
is accessible and readable from my browser (I’ll look later if the stream or DL doesn’t work),  
-possible to hide : [Screenshot by Lightshot (prnt.sc)](https://prnt.sc/A-_BY5Ka6Oin) the `Aria2.session` ?

> [@Jappe](#):
>
> Nice!  
> Did you restart lighttpd or the whole device?  
> In my test it was working just with `service lighttpd force-reload`

I have restart the device … after the last command : `service lighttpd force-reload`

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [8 December 2022 17:12 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/15 "2022-12-08T17:12:22Z")

</div>

> [@TahitianVibes](#):
>
> -possible to hide : [Screenshot by Lightshot (prnt.sc)](https://prnt.sc/A-_BY5Ka6Oin) the `Aria2.session` ?

For this you can add a line to the created config file:

```auto
dir-listing.exclude = ( "aria2.session" )

```

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [8 December 2022 17:17 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/16 "2022-12-08T17:17:43Z")

</div>

In this one … `/etc/lighttpd/conf-available/99-dir-list-downloads.conf` - that’s right ?

|edit |- All work like a charm —

a orera’ te pia toetoe’ - mauruuru roa’ 🤙

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [11 December 2022 10:13 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/17 "2022-12-11T10:13:59Z")

</div>

> [@TahitianVibes](#):
>
> service lighttpd force-reload

Btw, we use systemd, so the native command is:

```bash
systemctl restart lighttpd

```

---

<div class="post-metadata">

### Author: ![TahitianVibes](https://dietpi.com/forum/user_avatar/dietpi.com/tahitianvibes/32/3058_2.png) [@TahitianVibes](https://dietpi.com/forum/u/TahitianVibes)
#### Post date: [11 December 2022 10:18 UTC](https://dietpi.com/forum/t/lighttpd-symbolic-link-configuration/15186/18 "2022-12-11T10:18:22Z")

</div>

@MichaIng , yess ok - thank you for the clarification 😉
