# TasmoAdmin "Not Found" after visiting Login Page

**URL:** https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632
**Category:** Troubleshooting
**Created:** [9 August 2023 20:36 UTC](https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632 "2023-08-09T20:36:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![TBirth](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/t/2bfe46/32.png) [@TBirth](https://dietpi.com/forum/u/TBirth)
#### Post date: [9 August 2023 20:36 UTC](https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632/1 "2023-08-09T20:36:51Z")

</div>

```auto
root@DietPi4b:~# cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=20
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
G_LIVE_PATCH_STATUS[0]='applied'
root@DietPi4b:~# echo $G_DISTRO_NAME $G_RASPBIAN
bookworm 0
root@DietPi4b:~# uname -a
Linux DietPi4b 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
root@DietPi4b:~# dpkg --print-architecture
arm64
root@DietPi4b:~# echo $G_HW_MODEL_NAME
RPi 4 Model B (aarch64)

```

- Power supply used | (POE Adapter)
- SD card used | (SSD)

#### Additional Information (if applicable)

- Software title | (EG: TasmoAdmin)
- Was the software title installed freshly or updated/migrated? Fresh installation
- Can this issue be replicated on a fresh installation of DietPi? Yes  
 ← If you sent a “dietpi-bugreport”, please paste the ID here → 5d5bdec4-2d25-4a8c-9820-8c9f464f7043

#### Steps to reproduce

1. Fresh installation of TasmoAdmin via dietpi-software

#### Expected behaviour

- Showing Login Page after visiting [http://192.168.XX.X/tasmoadmin](http://192.168.XX.X/tasmoadmin) (IP hidden)

#### Actual behaviour

- Showing “Not Found” in Browser

#### Extra details

- Webserver: Lighttpd

---

<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: [9 August 2023 22:00 UTC](https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632/2 "2023-08-09T22:00:22Z")

</div>

I tested with nginx and lighttpd and both showed 404, it redirects to `/tasmoadmin/login` which does not exist.  
But according to [this](https://github.com/MichaIng/DietPi/pull/6328#issuecomment-1532000339) it worked back in May 🤔

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [10 August 2023 10:27 UTC](https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632/3 "2023-08-10T10:27:27Z")

</div>

It looks like something has changed in the current Tasmoadmin version and the web server configuration with `Nginx` and `Lighttpd` no longer works, while Apache2 still works fine. Something we need to have a look into. Ping @MichaIng

---

<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: [10 August 2023 11:07 UTC](https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632/4 "2023-08-10T11:07:39Z")

</div>

Nasty that the release notes at least do not contain any hint about such change: [Release v3.1.0 · TasmoAdmin/TasmoAdmin · GitHub](https://github.com/TasmoAdmin/TasmoAdmin/releases/tag/v3.1.0)

Also I so not see something in the actual changed files: [Comparing v3.0.8...v3.1.0 · TasmoAdmin/TasmoAdmin · GitHub](https://github.com/TasmoAdmin/TasmoAdmin/compare/v3.0.8...v3.1.0)

The redirect is correct: [https://github.com/TasmoAdmin/TasmoAdmin/blob/ccab9fdb949abd27aa5a644e287f0b085abdd918/tasmoadmin/index.php#L66-L69](https://github.com/TasmoAdmin/TasmoAdmin/blob/ccab9fdb949abd27aa5a644e287f0b085abdd918/tasmoadmin/index.php#L66-L69)

The Lighttpd config contains this rewrite rule:

```auto
"^/tasmoadmin/login$" => "/tasmoadmin/login.php",

```

But it needs to be

```auto
"^/tasmoadmin/login$" => "/tasmoadmin/pages/login.php",

```

it seems: [https://github.com/TasmoAdmin/TasmoAdmin/blob/ccab9fdb949abd27aa5a644e287f0b085abdd918/tasmoadmin/pages/login.php](https://github.com/TasmoAdmin/TasmoAdmin/blob/ccab9fdb949abd27aa5a644e287f0b085abdd918/tasmoadmin/pages/login.php)  
This changed in v3.0.0 already, so unless there was some additional internal helper to redirect to the correct login page, this should have never worked since Bookworm on.

---

<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: [13 August 2023 20:19 UTC](https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632/5 "2023-08-13T20:19:47Z")

</div>

Fixed with: [DietPi-Software | TasmoAdmin: Fix Nginx and Lighttpd config on Bookworm by MichaIng · Pull Request #6545 · MichaIng/DietPi · GitHub](https://github.com/MichaIng/DietPi/pull/6545)

While with Nginx it was trivial, it took me the whole evening to figure out how to fix it for Lighttpd:

- `/tasmoadmin/pages/login.php` is the correct login script, but it cannot be called directly.
- Since TasmoAdmin 3.0.0, all requests must be done via `index.php`, appending query strings and paths. Hence the redirect target needs to be `/tasmoadmin/index.php/login`. The same is true for all other rewrites. Positive aspect is that there is no complicated per-URL logic required anymore, but a single rule to rewrite all `/tasmoadmin/foo` to `/tasmoadmin/index.php/foo` is sufficient. The backend now has a front controller to internally handle request URLs correctly.
- While this works with Apache and Nginx, Lighttpd has problems: Deep investigation revealed a general problem about how Lighttpd sets FastCGI parameters when doing rewrites to the backend. Particularly, it sets `PHP_SELF` to `/tasmoadmin/index.php/login` while it is intended to be the path to the script only, i.e. `/tasmoadmin/index.php`. With the path still appended to the URL, the backend now internally creates all URLs (hence all navigation links) prefixed with `/tasmoadmin/index.php/`, as it is now understood as parent directory of the script `login`, instead of the script itself. Hence e.g. all asset URLs are broken.
- I observed the same problem when trying to beautify URLs in ownCloud and Nextcloud, hence removing the `index.php`. The rewrite works in one direction, but the backend creates all internal URLs again with `index.php`.
- What luckily works is doing rewrites to `/tasmoadmin/index.php/?login`, hence appending the path as query string instead. Lighttpd then does the split correctly and thank god the backend still handles everything correctly.

I hope that with the same little change, pretty URLs will finally work as well for Nextcloud and ownCloud with Lighttpd.

Please update your TasmoAdmin Lighttpd config and let me know whether there are still issues:

```sh
sudo curl -sSfo /etc/lighttpd/conf-available/99-dietpi-tasmoadmin.conf 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.conf/dps_27/lighttpd.tasmoadmin.3.conf'
sudo systemctl restart php8.2-fpm lighttpd

```
