Dafault Css/Tailwind Not working in production

So guys, i'm pretty desperate. I'm using Laravel API and Filament for my backend. Actually as "views" i only have filament working, laravel is totally empy (using it just for API). When i'm doin the deploy and open it on the ip address all the styles are actually gone... what can i do about it? I've almost tried anything and no documentation talk about this (except for custom theme THAT IS NOT my case), PLS HELP!!!
11 Replies
Dennis Koch
Dennis Koch6mo ago
First: Check your DevTools. Any errors (console)? Any stylesheets not loaded (network)?
Lux Auram
Lux AuramOP6mo ago
in the console is everything red of course... a lot of these "forms.css:1

Failed to load resource: the server responded with a status of 502 (Bad Gateway)" A lot of these as well "module.esm.js:553 Alpine Expression Error" and other errors like these "Uncaught TypeError: Cannot read properties of undefined (reading 'isOpen')" (due to alpine and tailwind error i supposed) Any clue?
Dennis Koch
Dennis Koch6mo ago
Failed to load resource: the server responded with a status of 502 (Bad Gateway)"
Well, if the resources aren't delivered by the server I'd check the server configuration. But hard to help with any info about the server and config.
Lux Auram
Lux AuramOP6mo ago
i'll take a look but... i have the "typed content", i just don't have the style and the js... what can be wrong so?
Dennis Koch
Dennis Koch6mo ago
502 Bad Gateway sounds like a misconfiguration for static files
Lux Auram
Lux AuramOP6mo ago
i created my .conf file using the one on laravel... any ideas where i can find a better one? Cause mine is actually this:
server {
listen 80;
listen [::]:80;
server_name MY_DOMAIN;
root /var/www/MY_DIR/MY_DIR/public;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

charset utf-8;

location / {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

error_page 404 /index.php;

location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}

location ~ /\.(?!well-known).* {
deny all;
}
}
server {
listen 80;
listen [::]:80;
server_name MY_DOMAIN;
root /var/www/MY_DIR/MY_DIR/public;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

charset utf-8;

location / {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

error_page 404 /index.php;

location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}

location ~ /\.(?!well-known).* {
deny all;
}
}
Dennis Koch
Dennis Koch6mo ago
Not sure. But what's running on proxy_pass http://127.0.0.1:8000;?
Lux Auram
Lux AuramOP6mo ago
I've just changed that... but nothing happened... i really think it's not loading style or even nor alpine and js Do i have to put anything into the AppServiceProvider? Or into the AdminPanelProvider? I really have no clue.... and what about ->viteTheme()? Even if i don't have any custom theme
Lux Auram
Lux AuramOP6mo ago
I've just found this, i'm gonna read it even if it's filament 2.x https://v2.filamentphp.com/tricks/fix-filament-assets-nginx
Filament
Fix Filament assets not loading in Nginx by Ida Bagus Gede Pramana ...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Lux Auram
Lux AuramOP6mo ago
I've tried to add this but didnt work...
location ^~ /filament {
try_files $uri $uri/ /index.php?$query_string;
}
location ^~ /filament {
try_files $uri $uri/ /index.php?$query_string;
}
Dennis Koch
Dennis Koch6mo ago
Don’t think it’s related to your app because that’s a server error coming from nginx. And the assets shouldn’t be server by PHP
Want results from more Discord servers?
Add your server