Closed IlyaBuldakov closed 4 months ago
Hello there! Thanks for opening your first issue on this repo!
Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.
Backpack communication channels:
backpack-for-laravel
tag;Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.
Thank you!
-- Justin Case The Backpack Robot
Here is my:
version: "3"
services:
nginx:
image: nginx
ports:
- 80:80
volumes:
- ../:/var/www/app:cache
- type: bind
source: nginx.conf
target: /etc/nginx/nginx.conf
depends_on:
- php-fpm
networks:
- next
php-fpm:
build: .
volumes:
- ../:/var/www/app:cache
- ../docker/php.ini-development:/usr/local/etc/php/php.ini-development
networks:
- next
depends_on:
- db
db:
image: mysql
ports:
- 3306:3306
networks:
- next
environment:
MYSQL_ROOT_PASSWORD: my_password_here
networks:
next:
driver: bridge
events {
} http { server { listen 80; server_name localhost; root /var/www/next/public;
index index.php;
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
} }
And images:
![image](https://github.com/Laravel-Backpack/CRUD/assets/26491536/658ee28c-dbdd-4206-9fe3-5708f22e9ab2)
![image](https://github.com/Laravel-Backpack/CRUD/assets/26491536/b6977253-32d7-42a8-930d-e65c7c0aa337)
![image](https://github.com/Laravel-Backpack/CRUD/assets/26491536/4673941f-eb17-4cb5-829d-c04266670325)
Hi @IlyaBuldakov
According to the docker compose file you sent, the APP_URL should be http://localhost in your .env file. Perhaps you forgot to remove port 8000?
If you don't have the port and that’s not causing the problem, have you tried resetting / clearing the asset cache?
And if so, can you show us the response header and the response of the file in error from the Chrome inspector for an external file?
Hey @dimer47
I set APP_ENV=http://localhost and the behavior remains the same - no errors, all files were received successfully, but in response I get clean HTML.
Here is response headers: And response body is something like this... (can't upload)
@IlyaBuldakov
Interesting, the files seem to be returned in plain/text. Try modifying your nginx configuration, adding mimes, default type and rules for your assets.
Nginx conf
events {
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
root /var/www/next/public;
index index.php;
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
}
@dimer47 All the same types
Bro, give me some time - it's working, I'm trying to form the steps to set out in the issue
The problem was that I didn't pay attention to what I was getting text/plain
. @dimer47 helped me start digging in the right direction. He suggested nginx.conf
, which I made a couple of changes to and everything worked! Thank you very much!
Here is my new nginx.conf
:
events {
}
http {
include /etc/nginx/mime.types;
sendfile on;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
root /var/www/app/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
}
The problem was that I didn't pay attention to what I was getting
text/plain
. @dimer47 helped me start digging in the right direction. He suggestednginx.conf
, which I made a couple of changes to and everything worked! Thank you very much!Here is my new
nginx.conf
:events { } http { include /etc/nginx/mime.types; sendfile on; default_type application/octet-stream; server { listen 80; server_name localhost; root /var/www/app/public; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~* \.php$ { try_files $uri = 404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass php-fpm:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } } }
Thank you @IlyaBuldakov for getting back with the solution, I am sure it will help someone facing the same issue in the future.
@dimer47 kudos to you man, thanks for the help here, much appreciated 🙏
Cheers
Bug report
What I did
I use laravel backpack and everything works when I start the server using php artisan serve, and then use the admin panel at localhost:8000/admin. ??
What I expected to happen
I expected that when I launch my application in the docker container everything will work properly ??
What happened
After running nginx + php fpm + mysql, styles are available (php fpm sends request to my nginx and gets 200 status), but are not displayed on the page ??
What I've already tried to fix it
I tried reinstalling the backpack, also tried manual installation from the documentation, tried doing basset:check from the container (positive result), tried clearing the cache and publishing my vendor ??
Is it a bug in the latest version of Backpack?
Yes After I run
composer update backpack/crud
the bug... is it still there? YesBackpack, Laravel, PHP, DB version
Backpack - v6 Laravel - v11 PHP - 8.3 When I run
php artisan backpack:version
the output is:PHP VERSION:
8.3.7
PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI , fileinfo, ftp, gettext, iconv, exif, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, Zend OPcache
LARAVEL VERSION:
11.8.0.0
BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.3.4 backpack/crud: 6.7.14 backpack/generators: v4.0.5 backpack/theme-tabler: 1.2.10