0

I would like to run an Angular 8 app on lighttpd webserver installed on a Raspberry Pi. Unfortunately the app stops loading immediately leaving a blank browser screen. No error in browser console, no error in lighttpd logs, no hint. Just nothing. What exactly am I missing here? Maybe there's no way to get an Angular app running in lighttpd? Anyone got this to work?

This is my lighttpd config file:

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    "mod_redirect",
    "mod_rewrite"
)

server.document-root        = "/var/www/html"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
mwalter
  • 101
  • 1
  • The angular application has been installed on the RPi? Where? – Gerard H. Pille Mar 06 '20 at 17:25
  • Into the lighttpd default directory /var/www/html. See server.document-root in the config above. – mwalter Mar 08 '20 at 20:07
  • And this application contains only static files, or do you have a server process (node.js perhaps) running on the RPi? – Gerard H. Pille Mar 08 '20 at 21:45
  • Yes HTML and JS files only. Well some PNG, SVG, TTF and WOFF files as well. There are no additional server processes running besides sftp-server. – mwalter Mar 09 '20 at 07:38
  • Activate the access log too. Make sure lighttpd can write to the error log. Add 'debug.log-file-not-found = "enable"' to your configuration, perhaps debug.log-request-handling also. Inspect the requests sent by your browser, do they reach your server? – Gerard H. Pille Mar 09 '20 at 11:49
  • Okay I activated the access log. Everything looks fine. See various GET log entries of my browser. Error log is written too. See stop and start entries of lighttpd. But no errors. So weird and frustrating. – mwalter Mar 09 '20 at 20:55
  • But do you see all the requests your browser made? Your browser itself doesn't show any problem when you open the developer tools? – Gerard H. Pille Mar 09 '20 at 21:45
  • As I said in my question, browser console reports no errors. Just one warning saying website should use calc() function instead of zoom. In the developer tools I see that all website resources were fetched with 200 OK GET. Well, I will switch to Apache or Nginx and see if that works... – mwalter Mar 10 '20 at 07:56
  • I've added the single page Angular application from https://www.w3schools.com/angular/angular_application.asp to my lighttpd webserver, and it does what it's expected to do. – Gerard H. Pille Mar 10 '20 at 13:26
  • Well I took the original Angular tutorial from angular.io and deployed it to lighttpd. Everything works fine so it seems I have an application issue here. Differences are: My app is Angular 8, tutorial is Angular 7. My app is obfuscated and minimized, tutorial is not. – mwalter Mar 10 '20 at 16:43
  • Obfuscate & minimize the tutorial. What then? Grasping at straws: make your lighttpd config as simple as possible, no compression eg. But in the end it can be an application error. – Gerard H. Pille Mar 10 '20 at 17:04

1 Answers1

0

Well it was an application issue. After removing all keycloak auth dependencies it worked. Not sure there was some misconfiguration regarding authentication but I intend to switch to angular-oauth2-oidc library anyway.

mwalter
  • 101
  • 1