Genie Discord forum

Author Avatarmarius.drulea
1/13/2024, 8:47:10 PM

Here is my apache config.

<VirtualHost *:80>
        ProxyPreserveHost On
        ServerName 192.168.0.59 # private ip, just for testing purposes   
        ProxyPass / http://127.0.0.1:8000
        ProxyPassReverse / http://127.0.0.1:8000
        DocumentRoot /home/marius/.julia/dev/GenieApp
</VirtualHost>

So when I run the GenieApp stand-alone, everything works nicely and this is what I get: But when I access the app via apache2 this is what I get: . So it works, but without the styling. How can I fix this?

Author Avatarmarius.drulea
1/13/2024, 8:53:13 PM

Changed the channel name: Works behind Apache2, but no styling

Author Avatarmarius.drulea
1/13/2024, 10:02:15 PM

I have found a goodish documentation on this and managed to make it work:

Author Avatarmarius.drulea
1/13/2024, 10:04:00 PM
server {
  listen 80;
  listen [::]:80;

  server_name   192.168.0.59;
  root          /home/ubuntu/MyGenieApp/public;
  index         welcome.html;

  location / {
      proxy_pass http://localhost:8000/;
  }

  location /css/genie {
      proxy_pass http://localhost:8000/css/genie;
  }
  location /img/genie {
      proxy_pass http://localhost:8000/img/genie;
  }
  location /js/genie {
      proxy_pass http://localhost:8000/js/genie;
  }
}
Author Avatarmarius.drulea
1/13/2024, 10:05:09 PM

the css, images and js made only after I did the modifications above, like: location /css/genie { proxy_pass http://localhost:8000/css/genie; }

Author Avatarmarius.drulea
1/13/2024, 10:07:18 PM

@Pere , @essenciary am I correct with the updated locations for css, img and js? if so, the documentation shall be changed as well

Author Avatarmarius.drulea
1/13/2024, 10:11:26 PM

... and obviously this old section with deploying behind nginx shall be part of the new documentation: https://learn.genieframework.com/docs/guides/deploying-genie-apps

Author Avatarmarius.drulea
1/13/2024, 10:35:10 PM

Another issue: I have set the wrong root in the config above. But even if I set it correctly: root /home/marius/.julia/dev/MyGenieApp/public;, the behavior is the same. I still have to set the /css/genie proxies as above.

Author Avatarmarius.drulea
1/13/2024, 10:54:38 PM

I have found the css, img and js setting useless. The following config is sufficient:

Author Avatarmarius.drulea
1/13/2024, 10:55:10 PM
server {
  listen 80;
  listen [::]:80;

  server_name   192.168.0.59;
  root          /home/marius/.julia/dev/MyGenieApp/public;
  index         welcome.html;

  location / {
      proxy_pass http://localhost:8000/;
  }
}
Author AvatarPere
1/15/2024, 8:51:54 AM

Those settings are only needed when you want to serve static assets with NGINX, so your config is sufficient.

That old guide you found...we actually have an updated version on the current site https://learn.genieframework.com/docs/reference/workflow/nginx-reverse-proxy

but I see that it's not easy to find. I'll link to it from the deployment guide. I'm sorry that you had so much trouble @marius.drulea 🥹

Author Avatarmarius.drulea
1/15/2024, 3:47:57 PM

ok... that old guide only works for the old Genie style;

Author Avatarmarius.drulea
1/15/2024, 3:48:39 PM

I have tried to use it for thew new stuff('@page(...), ui(), GenieFramework) and it dit not work for me

Author Avatarmarius.drulea
1/15/2024, 3:52:01 PM

does this work for you?

Author AvatarPere
1/16/2024, 10:55:36 AM

I've tried having Genie apps behind a Traefik reverse proxy and it worked fine, but haven't tested NGINX. It seems we'll have to look into how it handles websockets, thanks for reporting.

Author Avatarmarius.drulea
1/17/2024, 12:16:14 AM

I would say it's worth adding the Traefik config to the doc, beside the nginx config. Same for Apache2.

Author AvatarPere
1/18/2024, 3:44:31 PM

The issue has to do with websocket config. It turns out someone else had run into this

https://discord.com/channels/774897545717219328/1041476306757496853/1041476306757496853

I updated the issue on Github too

Author Avatarmarius.drulea
1/18/2024, 8:52:38 PM

Changed the channel name: Solved Nginx settings to enable websockets