APP/Nginx redirect problem

Hi everyone,

I’m trying to package monica for yunohost.
Here’s the package:https://github.com/rndmh3ro/monica_ynh

It’s working fine so far, I can install the app. But when I open the frontend, no CSS and JS is loaded.
The app runs locally under https://ynh.dev/monica/, but it wants to load the JS and CSS from https://ynh.dev/build/css/app-8edc75e097.css, which should be https://ynh.dev/monica/build/css/app-8edc75e097.css:

I think it’s a problem with my nginx config, but I’m not sure on how to fix this. I tried working with rewrite and used various online examples for laravel (the PHP framework used) and nginx but I can’t get it to work.

Here’s the config:

location /monica {
alias /var/www/monica/public ;
if ($scheme = http) {
  rewrite ^ https://$server_name$request_uri? permanent;
}
index index.php;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
  fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  fastcgi_pass unix:/var/run/php5-fpm.sock;
  fastcgi_index index.php;
  include fastcgi_params;
  fastcgi_param REMOTE_USER     $remote_user;
  fastcgi_param PATH_INFO       $fastcgi_path_info;
  fastcgi_param SCRIPT_FILENAME $request_filename;
}

# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

I tried installing it, and image/CSS URLs are absolute ones (i.e. /build/css/app-8edc75e097.css while I installed to /monica). It could be an application setting to change. For instance, your .env APP_URL variable is set to http://localhost (but maybe it has nothing to do with that!)

1 Like

Thanks, you’re right! After investigation more, this seems to be normal for laravel apps:


I’ll submit an issue with monica.

1 Like