%title Shaarli Setup
:ops:nix:bowl:
%date 2020-11-21 14:17

So I finally got Shaarli all configured. It turns out the `Network Redirection Error` that I was facing had to do with `nginx` Server Blocks aka Virtual Hosts
Setting the port and IP address as the virtual host name during Shaarli setup led to some strange re-direction that neither FF nor Chrome were happy to display (though cURL didn't have any issues). I fixed this by disabling nextcloud which previously owned the non-port server host and made shaarli the only web-app running. This led to the redirect working fine and able to continue as normal. 
The setup still isn't quite reproducible because I need to do `ln -s $(nix eval nixos.shaarli.outPath)/* $dataDir` to place all the shaarli files in the dataDir, then `chown shaarli:shaarli $dataDir` and finally `cp config.php $dataDir/config.php` to get everything running. 
I had much more sucess with debugging after setting `php_admin_value[error_log] = "/var/log/nginx/phpfpm.log"` and using `strace -p <phpfpm-pid>` so that I actually knew what was going wrong. I learnt that when using `root = pkgs.shaarli` and setting `SHAARLI_CONFIG` even though shaarli does read the right config file, it doesn't seem to apply that to reading the data directory as defined by the config and was still trying to access the nix store data folder which was causing issues. 
Anyways I think I now know enough that I should be able to re-configure everything pretty easily if it breaks. So Success!!
